drop down box display
2 posts by 2 authors in: Forums > CMS Builder
Last Post: March 3, 2011 (RSS)
By dmn - March 1, 2011 - edited: March 2, 2011
Love CMSB and what it can do - i have a question about dropdown box searches - i have 4 dropdowns - see below - what i want to do is make the drop down box display the selection picked by the user after the page displays the results of the search - eg if Mono Conductor is selected and the search returns everything for that selection i want Mono Conductor to stay selected rather than have the "-please select" reapper as the option - also if someone then chooses the size dropdown - Mono Conductor will stay selected as well as the size option chosen and then so on with each of the forms - is this possible - i'm just starting to build this and the client made that request when i demoed it for him - as it was the search was working fine
<form method="POST" action="cableselection.php" style="margin:0;">
<select name="category" onchange="this.form.submit();"><option value="none">- please select</option>
<option value="Mono Conductor">Mono Conductor</option>
<option value="Multi Conductor">Multi Conductor</option>
</select>
</form>
<form method="POST" action="cableselection.php" style="margin:0;">
<select name="size" onchange="this.form.submit();"><option value="none">- please select</option>
<option value="185-3/16">185-3/16</option>
<option value="224-7/32">224-7/32</option>
<option value="258-1/4">258-1/4</option>
</form>
<form method="POST" action="cableselection.php" style="margin:0;">
<select name="max_temp" onchange="this.form.submit();"><option value="none">- please select</option>
<option value="300">300</option>
<option value="500">500</option>
</select> </form>
<form method="POST" action="cableselection.php" style="margin:0;">
<select name="armour" onchange="this.form.submit();"><option value="none">- please select</option>
<option value="12/12">12/12</option>
<option value="12/18">12/18</option>
<option value="15/15">15/15</option>
<option value="18/18">18/18</option>
<option value="18/18">24/24</option>
</select></form>
<form method="POST" action="cableselection.php" style="margin:0;">
<select name="category" onchange="this.form.submit();"><option value="none">- please select</option>
<option value="Mono Conductor">Mono Conductor</option>
<option value="Multi Conductor">Multi Conductor</option>
</select>
</form>
<form method="POST" action="cableselection.php" style="margin:0;">
<select name="size" onchange="this.form.submit();"><option value="none">- please select</option>
<option value="185-3/16">185-3/16</option>
<option value="224-7/32">224-7/32</option>
<option value="258-1/4">258-1/4</option>
</form>
<form method="POST" action="cableselection.php" style="margin:0;">
<select name="max_temp" onchange="this.form.submit();"><option value="none">- please select</option>
<option value="300">300</option>
<option value="500">500</option>
</select> </form>
<form method="POST" action="cableselection.php" style="margin:0;">
<select name="armour" onchange="this.form.submit();"><option value="none">- please select</option>
<option value="12/12">12/12</option>
<option value="12/18">12/18</option>
<option value="15/15">15/15</option>
<option value="18/18">18/18</option>
<option value="18/18">24/24</option>
</select></form>
Re: [dmn] drop down box display
By Jason - March 3, 2011
Hi,
We have a function called "selectedIf". This compares two values and if they are the same, it outputs selected = "selected" (ie, selects that drop down value.
Here's an example of how you can use this:
Hope this helps get you started.
We have a function called "selectedIf". This compares two values and if they are the same, it outputs selected = "selected" (ie, selects that drop down value.
Here's an example of how you can use this:
<form method="POST" action="cableselection.php" style="margin:0;">
<select name="category" onchange="this.form.submit();"><option value="none">- please select</option>
<option value="Mono Conductor" <?php selectedIf('Mono Conductor' , @$_REQUEST['category'] );?> >Mono Conductor</option>
<option value="Multi Conductor" <?php selectedIf('Multi Conductor' , @$_REQUEST['category'] );?>>Multi Conductor</option>
</select>
</form>
Hope this helps get you started.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/