Is it possible to have an OnClick function (for a radio buton) do the exact same thing as the "reset" button does for a form? I have several checkboxes I want to clear when a different radio button is clicked.
Thanks. [ May 27, 2004: Message edited by: Chris Garrison ]
Well, you could call the reset() method of the form, but I'm not sure that's what you really want to do. Resetting would reset all elements to their initial conditions, even the element you are clicking.
Rather, I'd recommend just changing the state of the elements you want to 'reset' individually.
To back up a step - what I want is a jsp page with the following:
(radio button) Supreme Pizza <checkbox> no onions <checkbox> no sausage <checkbox> no pepperoni .... (radio button) Meat Lovers Pizza <checkbox> no sausage <checkbox> no canadian bacon... (radio button) Veggie <checkbox> no onion <checkbox> no bell pepper...
and so on.
You select Supreme Pizza initially and select the "no onions" chechbox.
But then you change your mind and click the MeatLovers. The radio button is reset correctly but how can I automatically clear the "no onions" checkbox from the Supreme Pizza?
I've received advice on how to do this - but it all involved "hardcoding" values in the jsp - like document.form.checkbox.checked = false . The problem is that I want to load this page dynamically. If I want to add a new menu Item or ingredient, I don't want to have to change the jsp.
Another suggestion was to use a counter for naming the checkboxes. This is fine except that the response object has "no checkbox15" instead of "no onions" when subsequent jsps are called which doesn't do me much good either. Am I missing something?
Of course I could hard code the script stuff, but I don't want to have to reprogram the jsp every time the menu changes.
Maybe this isn't even possible. I'm lost. Thanks for the help.