| ||||||||||
![]() |
Shopping cart software Solutions for online shops and malls | |||||||||
![]() |
![]() |
|
X-Cart Home | ![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
How to reference a drop down | |||
![]() |
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
![]() Hi,
I hope someone out there can help. I want to create a select drop down such as: <select name="custom_drop_down"> <option selected value="one">Select your option...</option> <option value="two">Option 1</option> <option value="three">Option 2</option> </select> and then pass over whatever the selected option value is (i.e the string one, two or three) as a smarty variable in a from. How can I do this assignment? Your help is greatly appreicated. Thanks, Philip.
__________________
----------------------------------------- X-Cart5 v5.2.16 (Live) ----------------------------------------- |
|||||||
#2
|
|||||||||
|
|||||||||
![]() maybe explain a bit more
__________________
Looking for a reliable X-cart host ? You wont go wrong with either of these. ![]() ![]() |
|||||||||
#3
|
|||||||
|
|||||||
![]() ok, I worked it out. You can just do it simply with javascript and an onchange event.
In javascript functions: function set_parameter(){ document.formname.param_to_pass.value = document.formname.custom_drop_down.options[document.formname.custom_drop_down.selectedIndex].value; } Then in your form: <select name="custom_drop_down" onchange="set_parameter()"> <option selected value="one">Select your option...</option> <option value="two">Option 1</option> <option value="three">Option 2</option> </select> <input type="hidden" name="param_to_pass" value="one"> now on changing the drop down, it updates the value of param_to_pass to whatever the selected option value is. Philip.
__________________
----------------------------------------- X-Cart5 v5.2.16 (Live) ----------------------------------------- |
|||||||
|
|||
X-Cart forums © 2001-2020
|