• Post Reply Bookmark Topic Watch Topic
  • New Topic

Resetting fields in a form via radio button selection in a JSP

 
Lon Allen
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am wanting to be able to use a radio button on a form to disable all the editable fields on that form and reset their values (if they were changed) back to what they were when the page was originally loaded (similar to reset, but I don't want the radio button to change). The effect is that when the form is submitted to a javabean I don't want the disabled fields to be processed (I test the newValue in the bean against the original value and don't process anything if they haven't changed). All I want do in this case is detect that the radio button has been selected to perform some other processing. Likewise, I want another radio button to be able to re-enable the disabled fields when selected. IOW I want to be able to toggle the enabling of editable fields with resetting them to the original data when they are disabled.
Any help would be greatly appreciated.
[ October 31, 2002: Message edited by: Lon Allen ]
 
Lon Allen
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, so figured out how to disable the fields I wanted based on the selection of a checkbox:

The only question that remains is how do I reset the two fields I disabled to their original values (had they been changed before the checkbox was selected)? Isn't there a way to call a reset for each element in the form (similar to having a reset button on the form)?
[ October 31, 2002: Message edited by: Lon Allen ]
 
Lon Allen
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I guess I could have avoided this entire thread had I just waited alittle longer. I figured out my problem and have answered my own questions.
I added "document.forms.myForm.reset();" to the "if(x[2].checked)" condition in my function "check()".
Thanks anyway...
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!