I have a set of radio buttons, some of which can trigger the display of other form elements (i.e. the user clicks "I hate it", and the onclick property triggers Javascript which displays a textarea labeled "what do you dislike about it?"). I want to set up some validation code so that if the user types something into the revealed textarea, they can't change the radio button selection to something which would re-hide the textarea (i.e. in the example above, once they type "because it smells" into the textarea, the Javascript will prevent them from clicking on "I like it", which would subsequently hide the textarea they typed into).
Here's the problem: if multiple radio buttons could both make the textarea appear, can Javascript identify which one had been checked prior to the new onclick event? So, to use the example above, if radio buttons "I hate it" and "I don't like it much" will both display the textarea, can Javascript figure out which one had been selected prior to the user clicking on "I like it"? This is important because the validation code needs to reset the radio button group to the previous legal value, or else it's useless.
Here's the problem: if multiple radio buttons could both make the textarea appear, can Javascript identify which one had been checked prior to the new onclick event? So, to use the example above, if radio buttons "I hate it" and "I don't like it much" will both display the textarea, can Javascript figure out which one had been selected prior to the user clicking on "I like it"? This is important because the validation code needs to reset the radio button group to the previous legal value, or else it's useless.