I have a HTML page with a form that has a bunch of controls. Of these there are three particular controls that I am having problems with. There is a radio button group (two radio buttons) and one text box. The radio button group consists of two buttons that can take "Yes" or "No" values. The user has to select one of the radio buttons and if the user selects the one that has the "Yes" value, he has to be fill in a value in the text box. If the user selects "No", the text boxes are not mandatory.
Here is the HTML code
<dt><label class="mandatory">Do you want to be included in the mailing?</label></dt>
<dd><input class="radio" name="MailingSelf" type="radio" value="Yes" /><span>Yes. <font color="#0000FF" size="-5">If yes, please enter mailing address below</font></span> </dd>
<dd><input class="radio" name="MailingSelf" type="radio" value="No" />No. </dd>
<dt><label >Mailing Address : </label>
<dd><textarea name="mailingselfaddress" cols="" rows=""></textarea></dd>
for (counter = 0; counter < form.MailingSelf.length; counter++)
// If a radio button has been selected it will return true
// (If not it will return false)
self_mailer = true;
alert("Please Select If You Want To Be Included In The Mailing");
if (self_mailer_value=="Yes" && form.mailingselfaddress.value="")
alert("Please enter the address that you want to include in the mailing");
This is not working. It will prompt be to select a radio button if it is not selected but once I select "Yes", it is not forcing me to fill in the text box. Why is that? Is there anything I can do to fix it.