Bit of help please, re form validation.

J

J-P-W

Hi I'm a VB bloke really, but need to use javascript from time to time.


I have a form an validate it as follows:
~~~~~~~~~~
function Validate()
{
if (QuotePart2.SubsidenceCover.Value=="Yes" &&
QuotePart2.Buildings.Value=="")
{
alert('You have selected buildings cover, but not entered the
value of the buildings, please do so.');
return false;
}

else if (document.QuotePart2.Agreed.checked == false)
{
alert('You must tick the box to show that you have checked the
sums insured, and they are correct.');
return false;
}
return true;
}
~~~~~~~~~~
My problem is that ensuring the checkbox is checked works just fine,
but I can't get the first bit to work, SubsidenceCover is a drop down,
if "Yes" is selected but there is no value in Buidings I need to stop
there, can anyone spot an error?

Many thanks

Jon
 
I

Ian Collins

J-P-W said:
Hi I'm a VB bloke really, but need to use javascript from time to time.


I have a form an validate it as follows:
~~~~~~~~~~
function Validate()
{
if (QuotePart2.SubsidenceCover.Value=="Yes" &&
QuotePart2.Buildings.Value=="")

Should be value, not Value.
 
J

J-P-W

Ian said:
Should be value, not Value.


I've now learnt that javascript is case sensitive!!! Thank you very
much, my validation now works, kindest regards, Jon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,682
Members
48,796
Latest member
Greg L.

Latest Threads

Top