By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,238 Members | 1,609 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,238 IT Pros & Developers. It's quick & easy.

Bit of help please, re form validation.

P: n/a
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

Jul 14 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
J-P-W wrote:
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.

--
Ian Collins.
Jul 15 '06 #2

P: n/a

Ian Collins wrote:
J-P-W wrote:
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.

--
Ian Collins.

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

Jul 15 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.