Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

How to reference a drop down

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 12-10-2005, 04:47 AM
 
phil_ phil_ is offline
 

Advanced Member
  
Join Date: Feb 2003
Location: Northern Ireland
Posts: 56
 

Default How to reference a drop down

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)
-----------------------------------------
Reply With Quote
  #2  
Old 12-10-2005, 10:05 AM
  shan's Avatar 
shan shan is offline
 

X-Guru
  
Join Date: Sep 2002
Location: Birmingham, UK
Posts: 6,163
 

Default

maybe explain a bit more
__________________
Looking for a reliable X-cart host ?
You wont go wrong with either of these.

EWD Hosting
Hands On Hosting
Reply With Quote
  #3  
Old 12-10-2005, 10:20 AM
 
phil_ phil_ is offline
 

Advanced Member
  
Join Date: Feb 2003
Location: Northern Ireland
Posts: 56
 

Default

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)
-----------------------------------------
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 03:06 AM.

   

 
X-Cart forums © 2001-2020