- Moderated by:
- Support
-
- rank:
-
Helper
- registered:
- November 2004
- Status:
- offline
- last visit:
- 18.06.08
- Posts:
- 408
Code
if(document.vwarform.contactircchannel.value == "")
{
alert("Read COC is blank. You must type YES!");
document.vwarform.contactircchannel.focus();
return false;
}
if(document.vwarform.contactircchannel.value == "YES")
{
alert("Read COC is other than yes. You must type YES!");
document.vwarform.contactircchannel.focus();
return false;
}
The First statement works. However, the second is skipped. Anyone know
why?
I want that field to be YES and not blank or any other text. -
- rank:
-
Professional
- registered:
- December 2002
- Status:
- offline
- last visit:
- 24.08.08
- Posts:
- 1588
Try this
Code
if(document.vwarform.contactircchannel.value == "")
{
alert("Read COC is blank. You must type YES!");
document.vwarform.contactircchannel.focus();
return false;
}
else if(document.vwarform.contactircchannel.value != "YES")
{
alert("Read COC is other than yes. You must type YES!");
document.vwarform.contactircchannel.focus();
return false;
}
-Lobos
--
-Lobos
Professional PHP Framework Services: Concept, Development and Deployment -
- rank:
-
Helper
- registered:
- November 2004
- Status:
- offline
- last visit:
- 18.06.08
- Posts:
- 408
that works. However not for yes (lowercase)
I have tried
else if(document.vwarform.contactircchannel.value != "YES" || "yes")
and
else if(document.vwarform.contactircchannel.value != "YES" || document.vwarform.contactircchannel.value != "yes")
and
else if(document.vwarform.contactircchannel.value != "YES") || (document.vwarform.contactircchannel.value != "yes")
also tried it with the ^ operator in all 3 ways. -
- rank:
-
Professional
- registered:
- December 2002
- Status:
- offline
- last visit:
- 24.08.08
- Posts:
- 1588
Well you are obviously wanting a yes answer so why not use a check box - this will acheive the same thing without all the mucking around...
-Lobos
--
-Lobos
Professional PHP Framework Services: Concept, Development and Deployment
