Advertising | MPAA | SMS-Sprüche | Advertising | Bad Credit Mortgages
javascript - if statement problem [Archive] - PCMech Forums

PDA

View Full Version : javascript - if statement problem


mysterio2099
07-21-2005, 02:35 PM
i'm using this as a code to validate fields in a form...this is only a section, but its the one I'm having a problem with:

function validate(form) {

if (form.topic.value == "-Please select a topic from the list below-")
{
alert("Please select a topic.")
form.topic.focus()
return false
}

if (form.firstname.value.length == 0)
{
alert("Please enter your first name.")
form.firstname.focus()
return false
}
}

the first if is the problem. I dont know what to put after "value" to make it correct. What it is, is a drop down menu, and "-Please select a topic from the list below-" is the default choice (which means they didn't choose anything, and need to).

I have no experience with javascript. This is a code written by someone else, and I just edited it (I have experience in HTML, and PHP, so I know my way around a tad).

Please help if ya can,

mysterio2099
07-21-2005, 03:52 PM
Problem solved!!!!!