Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need suggestions for a validation script involving radio buttons

Status
Not open for further replies.

nalbiso

Programmer
Aug 31, 2000
71
US
Hi!

I have a form with two radio buttons with the group name of status. The value of one of the buttons is "In Office" the other button's value is "Out of Office". I also have a textbox called destination. I am looking for suggestions for a script cause an alert box to appear when the "Out of Office" radio button is checked and the textbox called destination is not filled out.

Thanks for any help!
 
somethin like:
Code:
function validate() {
     if (document.formName.status.radioName == true || document.formName.destination.value == '') {
          alert("fill the form out right");
     }
}
-Greg :-Q
 
i think there shuld be && instead of ||.. Victor
 
oops, sorry about that...vituz is right it should be:
Code:
function validate() {
     if (document.formName.status.radioName == true && document.formName.destination.value == '') {
          alert("fill the form out right");
     }
}
-Greg :-Q
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top