Howdy,
I'm trying to set up my form so that the user can click on a Reset button to reset the form to the original values that were in the select boxes. However, it appears that while this works with most of my select boxes, there are a few that it isn't working on.
I have a select box that is dynamically changed based on some selections in other boxes using the following code, so some options are removed.
After the select boxes are updated to reflect choices they can make, the user will be able to either submit the form or reset the form back to its original state (and all original options are available again).
Unfortunately, my reset button isn't resetting the boxes that had options removed from them. The following is my code for the Continue and Reset buttons (Continue updates the various select boxes; Reset should put the form back to its original state):
I think I must be missing something somewhere but I'm not sure what it is. Is it possible to reset ALL select boxes, even ones where you have removed options previously?
Thanks!
Lori
I'm trying to set up my form so that the user can click on a Reset button to reset the form to the original values that were in the select boxes. However, it appears that while this works with most of my select boxes, there are a few that it isn't working on.
I have a select box that is dynamically changed based on some selections in other boxes using the following code, so some options are removed.
Code:
function updateProgList()
{
// Updates the Program list by removing funding groups not selected
var progElement = document.getElementsByTagName('select')['prog2'];
var i = 0;
var k = 0;
// For each item in the funding group that was NOT previously selected...
for ( k = 0; k < modFundsArray.length; k++ )
{ // ... for each item in the Program list, remove the programs that begin
// with the current funding group code being passed to it via 'for'
i = 0; // reset to zero so it will go back through entire prog list again
while ( i < progElement.length )
{ if ( progElement[i].value.substr(0,2) == modFundsArray[k] )
{ progElement.removeChild(progElement[i]); }
else { i++; }
}
}
}
After the select boxes are updated to reflect choices they can make, the user will be able to either submit the form or reset the form back to its original state (and all original options are available again).
Unfortunately, my reset button isn't resetting the boxes that had options removed from them. The following is my code for the Continue and Reset buttons (Continue updates the various select boxes; Reset should put the form back to its original state):
Code:
<td class="vert" width="25%">
<input type="button" name="bmscont" id="bmscont" value="Continue"
onclick="hideShowContinue('14_summary');"/>
<input type="reset" name="myreset" id="myreset" value="Reset" />
</td>
</tr>
I think I must be missing something somewhere but I'm not sure what it is. Is it possible to reset ALL select boxes, even ones where you have removed options previously?
Thanks!
Lori