I have some code and right now it has a submit button. Users select a date and region (state, country, etc.) and when both are selected they press the button and whamo. What I want to do is if they have JavaScript enabled I want to do away with the button and do the submit in the onchange of the combo boxes. Here's the code. Any help?
Response.Write(' ');
Response.Write('<INPUT TYPE="submit" id=submit Name="submit" style="VISIBILITY: hidden" value="'+Session('sSubmitButtonText')+'">');
Response.Write('</FORM>');
function onRegionChange()
{
var Region = String('');
var Index = Number(0);
var AreaIndex = Number(0);
var AreaList;
var RegionList;
AreaList = document.forms['datepicker'].selArea;
RegionList = document.forms['datepicker'].selRegion;
Region = RegionList.options[RegionList.selectedIndex].value;
// Add the All Areas selection under areas
addAreaToAreaList(AreaList, AreaIndex, 'ALL', ' - - All Subregions - - ');
AreaIndex++;
// Add the areas for the selected region
while (Index < sAreaArray.length)
{
if (sRegionArray[Index] == Region)
{
addAreaToAreaList(AreaList, AreaIndex, sAreaIDArray[Index], sAreaArray[Index]);
AreaIndex++;
}
Index = Index + 1;
}
// remove any extra areas from the previously selected region
AreaList.options.length = AreaIndex;
var dfound = Boolean(false);
var dIndex = Number(0);
while ((!dfound) && (dIndex < AreaList.options.length))
{
if (String(AreaList.options[dIndex].value) == "<%=Request.Querystring('selArea')%>")
{
AreaList.options.selectedIndex = dIndex;
dfound = true;
}
dIndex++;
}
if (bJScriptEnabled) {
document.forms['datepicker'].submit.click();
}