Hi,
I'm working on a filtered search form inspired by this thread: http://www.couchcms.com/forum/viewtopic.php?f=8&t=7620
It's quite amazing that all this can be done with Couch.
I have quite a lot of options to search for though. Therefore I would like to show dropdown B only if the value of dropdown A is X
for now I have done this in the following manner:
This works nicely, the hidden dropdown is necessary because I need a value for the search string later on.
The downside of this solution is that the user has to click "submit" before the next dropdown is shown.
I've tried the following code:
But that doesn't work.
Now I know there are some JavaScript solutions for this but I'm not that much of an expert in Java.
Also I've found a way to solve this in CSS, but then you would need an ID for each option (instead of one ID for the input) , which I couldn't do using the cms:input tag. (maybe this is possible anyhow?).
Does anyone have any suggestions?
I'm working on a filtered search form inspired by this thread: http://www.couchcms.com/forum/viewtopic.php?f=8&t=7620
It's quite amazing that all this can be done with Couch.
I have quite a lot of options to search for though. Therefore I would like to show dropdown B only if the value of dropdown A is X
for now I have done this in the following manner:
- Code: Select all
<cms:input type="dropdown" name="dropdownA" opt_values="none=-| X |Y " opt_selected='-' />
<cms:if frm_dropdownA='X'>
<cms:input type="dropdown" name="dropdownB" opt_values=" none=- | X |Y | opt_selected='-'/>
<cms:else/>
<span class="hidden">
<cms:input type="dropdown" name="dropdownB" opt_values=" none=- | X |Y | opt_selected='-'/>
</span>
</cms:if>
This works nicely, the hidden dropdown is necessary because I need a value for the search string later on.
The downside of this solution is that the user has to click "submit" before the next dropdown is shown.
I've tried the following code:
- Code: Select all
<cms:if dropdownA=='X'>
<cms:input type="dropdown" name="dropdownB" opt_values=" none=- | X |Y | opt_selected='-'/>
<cms:else/>
<span class="hidden">
<cms:input type="dropdown" name="dropdownB" opt_values=" none=- | X |Y | opt_selected='-'/>
</span>
</cms:if>
But that doesn't work.
Now I know there are some JavaScript solutions for this but I'm not that much of an expert in Java.
Also I've found a way to solve this in CSS, but then you would need an ID for each option (instead of one ID for the input) , which I couldn't do using the cms:input tag. (maybe this is possible anyhow?).
Does anyone have any suggestions?