Select field, show only child options
-
I have this working code:
<form role="search" method="get" id="searchform" action=""> <div> <strong>Search for:</strong> <strong>Type</strong> <select name='s' id='type' class='postform' > <option value='' selected='selected'>All</option> <option class="level-0" value="price">Price</option> <option class="level-0" value="color">Color</option>& </select> <br></br> <strong>Brand</strong> <select name='s' id='brand' class='postform' > <option class="level-0" value="lg">LG</option> <option class="level-0" value="samsung">Samsung</option> <option class="level-0" value="htc">HTC</option> </select> <br></br> <strong>Model</strong> <select name='s' id='model' class='postform' > <option value='' selected='selected'>All</option> <option class="level-0" value="galaxy s">Galaxy S</option> <option class="level-0" value="galaxy s2">Galaxy S2</option> </select> <input type="submit" id="searchsubmit" value="Search" onclick="return fn_submit_search();" /> </div> <script> function fn_submit_search(){ window.location='/?s='+document.getElementById('type').value+'+'+document.getElementById('brand').value+'+'+document.getElementById('model').value; return false; } </script </form>
The code is working great and I am able to search in site based on pre-definited search terms.
However, on the second field I have the Brand name. On the third field I have the Product name. In this moment if I choose Samsung, for example, I am allowed to select a model from another brand.
Which solution can I use to be able to have displayed the products from a single brand, once the second field (brand) is selected?
- The topic ‘Select field, show only child options’ is closed to new replies.