Problem with and IF statment on Submiting the form

M

Markus

Hallo

I have a problem when i click on the Submit button it does a validation but
i am having problem with the statement below. It does not submit the form if
the value of answer is more then 0.

if(document.FrontPage_Form1.answer2.value == "1")
{if(document.FrontPage_Form1.answer.value == "0")
alert("Please select Access Tables Requered!");
return false;
}
else
{
return false
}

Regards
Markus
 
R

Ronx

Does this work for you?

if(document.FrontPage_Form1.answer2.value == "1") {
if(document.FrontPage_Form1.answer.value == "0") {
alert("Please select Access Tables Required!");
return false;
}
}
else { return false }
 
M

Markus

yes
if asnwer 2 = 1 and answer <> 0 submit which is working
if answer 2 = 0 submit with out looking at answer at all which does not work

Regards Markus
 
R

Ronx

This will submit the form for all values of answer2 and answer,
EXCEPT answer2 = 1 AND answer = 0

if(document.FrontPage_Form1.answer2.value == "1") {
if(document.FrontPage_Form1.answer.value == "0") {
alert("Please select Access Tables Required!");
return false;
}
}
return true;


If you specifically require answer2 to be 0 for a submit, then

if (document.FrontPage_Form1.answer2.value > "1") { return false; }
if(document.FrontPage_Form1.answer2.value == "1") {
if(document.FrontPage_Form1.answer.value == "0") {
alert("Please select Access Tables Required!");
return false;
}
return true;

--
Ron Symonds - Microsoft MVP (FrontPage)
Reply only to group - emails will be deleted unread.
FrontPage Support: http://www.frontpagemvps.com/
http://www.rxs-enterprises.org/fp
 
M

Markus

Thank you its working now

Ronx said:
This will submit the form for all values of answer2 and answer,
EXCEPT answer2 = 1 AND answer = 0

if(document.FrontPage_Form1.answer2.value == "1") {
if(document.FrontPage_Form1.answer.value == "0") {
alert("Please select Access Tables Required!");
return false;
}
}
return true;


If you specifically require answer2 to be 0 for a submit, then

if (document.FrontPage_Form1.answer2.value > "1") { return false; }
if(document.FrontPage_Form1.answer2.value == "1") {
if(document.FrontPage_Form1.answer.value == "0") {
alert("Please select Access Tables Required!");
return false;
}
return true;

--
Ron Symonds - Microsoft MVP (FrontPage)
Reply only to group - emails will be deleted unread.
FrontPage Support: http://www.frontpagemvps.com/
http://www.rxs-enterprises.org/fp
 

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

Top