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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Required on selection

Status
Not open for further replies.

GoLdFiNgeR

IS-IT--Management
Jun 4, 2002
252
US
Ok, i got the last problem figured out, the web hosting company messed up but its being fixed so:

I have a drop donw menu with selections for phone or email,
if they choose phone i would like my phone number text box to be required to fill out info, and vice versa for my email,

is there a way to do this?
maybee an if statement or something?

your help is greatly appreciated

william
 
Yeah you use an IF statement...
Kinda like this:
Code:
function one() {
  if(document.formNAME.fieldNAME.options[0].selected == true) {
  alert("You must fill in the phone number");
  return false;  
  }
  if(document.formNAME.fieldNAME.options[1].selected == true) {
  alert("You must fill in the email address");
  return false;  
  }
}
And you call this function in the <form> tag as: onsubmit. I have not failed; I merely found 100,000 different ways of not succeding...
 
ok, ill try it out, thank you, then ill let you know if it worked
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top