Hi all,
I'm new to JavaScript and am trying to create a client side JavaScript form
validation script. I'm doing ok with validating text input boxes but have
a problem that I have not been able to solve and one I hope someone will
help me resolve.
I want to check the contents of a drop down box and if a certain item is
selected, check the contents of a text input box to see if a any text was
entered. If no text is entered, I want to put up a notice so the user
won't forget.
Here is a code segment that does work:
if (feedbackform.s ervices.value == 'none selected') {
alert("Please provide us which service option you are interested
in.");
feedbackform.se rvices.focus();
return false;
}
And here is the segment of code that to me looks ok, but it will not work
as expected.
if (feedbackform.s ervices.value == 'Existing website redesign' &&
feedbackform.cu rrenturl.value. length == 0)
{
alert("Please provide us with a URL");
feedbackform.cu rrenturl.focus( );
return false;
}
Any help appreciated.
Ray
I'm new to JavaScript and am trying to create a client side JavaScript form
validation script. I'm doing ok with validating text input boxes but have
a problem that I have not been able to solve and one I hope someone will
help me resolve.
I want to check the contents of a drop down box and if a certain item is
selected, check the contents of a text input box to see if a any text was
entered. If no text is entered, I want to put up a notice so the user
won't forget.
Here is a code segment that does work:
if (feedbackform.s ervices.value == 'none selected') {
alert("Please provide us which service option you are interested
in.");
feedbackform.se rvices.focus();
return false;
}
And here is the segment of code that to me looks ok, but it will not work
as expected.
if (feedbackform.s ervices.value == 'Existing website redesign' &&
feedbackform.cu rrenturl.value. length == 0)
{
alert("Please provide us with a URL");
feedbackform.cu rrenturl.focus( );
return false;
}
Any help appreciated.
Ray
Comment