View Full Version : Help with javascript and form fields

12-21-2003, 11:55 PM

I am still developing my javascript skills and have a question.

Say I have two radio buttons with the same name but different value. Selecting one of the radios is required. There are two text fields and depending on which radio is selected, one of the two text fields would be required.

So I have radios named "type" one value is "current" and one is "new".

If new is selected, then the text field "pbname" is requireed. If new is selected then the text field "reqno" is required.

I have spent about 5 hours scouring the net for examples, so if there is somewhere I can look, please help.



12-22-2003, 02:22 PM
With radio buttons that have the same name the browser would set them up in an array so you could determine if one or the other has been "checked" like this:
{do something}
{do something}

This would determine if the first radio button has been checked and if it has perform the statements within the first set of curly brackets. If not then do the statements in the next set of brackets (else). Hope that helps.