Trying to apply jQuery to Forms select combo box. Can't get onchange to work
I'm new jQuery but since I'm revising a site with a new look I thought I'd modernize it some too.
I'm using classic ASP and JavaScript. Comboboxes are fed via SQL. The process is to select year, make, mode, etc. to build a vehicle specification. I keep calling the same page with the additional information.
- function formHandler(form){
- var stryr = form + "="
- var URL = document.form.site.options[document.form.site.selectedIndex].value;
- var sURL = "displayveh.asp" + stryr + URL
- window.location.href = sURL;
- }
The html gets created via ASP and the above function gets called repeatedly on each subsequent selection.
- <form name='form' ><select name='site' size=1 onChange="javascript:formHandler('?iyear')">
- <option value=''>Select YEAR</option>
- <option value="2009"> 2009 </option>
- <option value="2008"> 2008 </option>
- <option value="2007"> 2007 </option>
- <option value="2006"> 2006 </option>
- <option value="1922"> 1922 </option>
- <option value="1921"> 1921 </option>
- </select></form>
The option values change and the formhandler call gets rebuilt each time with the new selection added on.
- <select name="site" size=1 onChange="javascript:formHandler('?iyear=1999&imake=FORD&imodel')">
The above would be the combobox select for model.
I can't get the onChange to work.
I've been working with autocomplete (ui.combobox) and have that working but can't get the onChange event to trigger. Simply can't get to another page or call same page with selected value.
I've been looking for an example of the autocomplete that goes to another page with the selected value but so far no luck. I'm still looking and reading but would really appreciate some help or pointer to an example that is closer to "live" than I've been able to find so far. I.e. a combobox that goes to another page with the value selected.
TIA