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="VISIBILI TY: hidden" value="'+Sessio n('sSubmitButto nText')+'">');
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.opti ons[RegionList.sele ctedIndex].value;
// Add the All Areas selection under areas
addAreaToAreaLi st(AreaList, AreaIndex, 'ALL', ' - - All Subregions - - ');
AreaIndex++;
// Add the areas for the selected region
while (Index < sAreaArray.leng th)
{
if (sRegionArray[Index] == Region)
{
addAreaToAreaLi st(AreaList, AreaIndex, sAreaIDArray[Index], sAreaArray[Index]);
AreaIndex++;
}
Index = Index + 1;
}
// remove any extra areas from the previously selected region
AreaList.option s.length = AreaIndex;
var dfound = Boolean(false);
var dIndex = Number(0);
while ((!dfound) && (dIndex < AreaList.option s.length))
{
if (String(AreaLis t.options[dIndex].value) == "<%=Request.Que rystring('selAr ea')%>")
{
AreaList.option s.selectedIndex = dIndex;
dfound = true;
}
dIndex++;
}
if (bJScriptEnable d) {
document.forms['datepicker'].submit.click() ;
}
Response.Write( ' ');
Response.Write( '<INPUT TYPE="submit" id=submit Name="submit" style="VISIBILI TY: hidden" value="'+Sessio n('sSubmitButto nText')+'">');
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.opti ons[RegionList.sele ctedIndex].value;
// Add the All Areas selection under areas
addAreaToAreaLi st(AreaList, AreaIndex, 'ALL', ' - - All Subregions - - ');
AreaIndex++;
// Add the areas for the selected region
while (Index < sAreaArray.leng th)
{
if (sRegionArray[Index] == Region)
{
addAreaToAreaLi st(AreaList, AreaIndex, sAreaIDArray[Index], sAreaArray[Index]);
AreaIndex++;
}
Index = Index + 1;
}
// remove any extra areas from the previously selected region
AreaList.option s.length = AreaIndex;
var dfound = Boolean(false);
var dIndex = Number(0);
while ((!dfound) && (dIndex < AreaList.option s.length))
{
if (String(AreaLis t.options[dIndex].value) == "<%=Request.Que rystring('selAr ea')%>")
{
AreaList.option s.selectedIndex = dIndex;
dfound = true;
}
dIndex++;
}
if (bJScriptEnable d) {
document.forms['datepicker'].submit.click() ;
}