Sorry, I thought the field was required.  Try this:

if(oForm.discode.value.length > 0 && !(oForm.discount.value == 'xyz123' ||
oForm.discount.value == 'abc1234')) {

This says if they enter a value, and that value is NOT 'xyz123' or
'abc1234', then display the error.

If they don't enter a value, it will never evaluate the comparison
condition.

See how that works.  If it doesn't work, post your code as you have it so we
can look at it all.

Dave

-----Original Message-----
From: Christine Stephens [mailto:[EMAIL PROTECTED] 
Sent: Thursday, August 14, 2008 3:01 PM
To: CF-Talk
Subject: Re: cfform validation for newbie

Hi Dave

the line -  if(oForm.discode.value != 'xyz123' && oForm.discode.value !=
'abc1234') { is giving an error - saying Expected ';'

also i wanted to claify - i might not have been so clear in my request...

the user could enter 1 of 2 possible entries into the non-required field...
'xyz123' OR 'abc1234'

i only add that in because it looked like in the coding below - that it
would only accept the answer of 'xyz123' - do you know how you could have it
check for both?

Thank you!!


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:311019
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to