Well, this looks like it would be best done client-side, but if you need a server-side solution, you want to do something like:
<xsl:if test="umbraco.library:RequestForm('nationalClient') = 'allClients'"> <!-- Display this list when "All clients" is selected --> ... </xsl:if> <xsl:if test="umbraco.library:RequestForm('nationalClient') = 'nationalClient'">
<!-- Display this list when "National clients" is selected --> ... </xsl:if>
You can use RequestQueryString if your form is going to be a GET form.
Actually, thinking about it, you will want to deal with no postbacks as well, so you actually want:
<xsl:choose>
<xsl:when test="umbraco.library:RequestForm('nationalClient') = 'nationalClient'">
<!-- Display this list when "National clients" is selected -->
...
</xsl:when>
<xsl:otherwise>
<!-- Display this list when "All clients" is selected, or no postback -->
...
</xsl:otherwise>
</xsl:choose>
If you leave the form action blank then it will post back to the current page URL; I would assume that the hash will maintain that behaviour as it shouldn't affect server behaviour at all.
As shown above a server side solution is missing one major thing and one possible thing:
1. You have no submit button, so unless you have a change event handler set up in other code that submits the form you'll never get a postback.
2. I seem to recall that the default method for forms if no specified is actually GET, so you'll eithre need to change my example to use umbraco.library:RequestQueryString or you'll have to add method="post" to your form tag.
Select menu options to choose between 2 child node lists
I have 2 child node lists. One for "All clients" and one for "National clients".
How can I get the options selected to display "All clients" and hide "National clients" and vice versa?
Here's my current XSLT, it's display both lists at the moment:
Well, this looks like it would be best done client-side, but if you need a server-side solution, you want to do something like:
You can use RequestQueryString if your form is going to be a GET form.
Actually, thinking about it, you will want to deal with no postbacks as well, so you actually want:
Thanks Rob I thought it would involve a "choose" tag.
I still need help with the select menu though, and the form. Can anyone help with this?
What help do you need? :o)
It seems like you're building a form where:
1. user selects either All Clients or National Clients
2. the form posts back to the page with the appropriate list
That aside, I'm not sure "#" is a valid form action? You might need to tell it explicitly to post back to the current page.
Also, is there a reason you've named the form field the same as the option value? (nationalClient)
In the end I used JQuery to achieve this. Would still like to know how to do it with XSLT and a form action.
But this method works well for me this time:
If you leave the form action blank then it will post back to the current page URL; I would assume that the hash will maintain that behaviour as it shouldn't affect server behaviour at all.
As shown above a server side solution is missing one major thing and one possible thing:
1. You have no submit button, so unless you have a change event handler set up in other code that submits the form you'll never get a postback.
2. I seem to recall that the default method for forms if no specified is actually GET, so you'll eithre need to change my example to use umbraco.library:RequestQueryString or you'll have to add method="post" to your form tag.
is working on a reply...