gianitoo
asked on
2 onsubmit events
is it possible to have 2 onsubmit events?
<form name="form1" method="post" action="http://www.pikefest.org/form/afp.asp?formid=36"OnSubmit="validat eemail;ret urn xlaAFPvalidate(this)">
my second does not work ok if i have 2 events????
<form name="form1" method="post" action="http://www.pikefest.org/form/afp.asp?formid=36"OnSubmit="validat
my second does not work ok if i have 2 events????
You can chain two function calls in, your handler without problm if that is what you look for.
<form name="form1" method="post" action="http://www.pikefest.org/form/afp.asp?formid=36" OnSubmit="validateemail(); return xlaAFPvalidate(this)">
<form name="form1" method="post" action="http://www.pikefest.org/form/afp.asp?formid=36" OnSubmit="validateemail();
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
bbbbbbb ... Roonan was right.
If the logic in each function is correct, then you want both successful for "post" to proceed. His logic will only run xlaAFPvalidate() if validateemail() was successful (i.e.: returned true).
* Roonan,
would this also work?
onSubmit="return !validateemail(); return xlaAFPvalidate(this);"
??
Peace and joy. mvan
If the logic in each function is correct, then you want both successful for "post" to proceed. His logic will only run xlaAFPvalidate() if validateemail() was successful (i.e.: returned true).
* Roonan,
would this also work?
onSubmit="return !validateemail(); return xlaAFPvalidate(this);"
??
Peace and joy. mvan
@mvan01
In your setup the xlaFPValidate(this) will never be executed, unless you add an if() clause surrounding the validateemail() call.
-r-
In your setup the xlaFPValidate(this) will never be executed, unless you add an if() clause surrounding the validateemail() call.
-r-
You can try to use:
onsubmit="return validateemail() && xlaAFPvalidate(this);"
-r-
onsubmit="return validateemail() && xlaAFPvalidate(this);"
-r-
@Roonan,
I do not doubt what you say. I wonder why, though. If validateemail() returns true, then !validateemail() evaluates false. So return !validateemail() should return false when validateemail() is true. And the converse, of course.
Peace and joy. mvan
I do not doubt what you say. I wonder why, though. If validateemail() returns true, then !validateemail() evaluates false. So return !validateemail() should return false when validateemail() is true. And the converse, of course.
Peace and joy. mvan
mvan
You have to consider that whenever you have a return the onsubmit is exited whether or not you return true or false.
So when considering a statement: return validateemail(); return xlaFPvalidate(this);
The second validation will never be called because the result of validateemail() is always returned no matter what its value is.
-r-
You have to consider that whenever you have a return the onsubmit is exited whether or not you return true or false.
So when considering a statement: return validateemail(); return xlaFPvalidate(this);
The second validation will never be called because the result of validateemail() is always returned no matter what its value is.
-r-
<NO POINTS>
When you want to execute "xlaAFPvalidate" only when "validateemail" return true;
You could do following..define a inline function,
<form name="form1" method="post" action="http://www.pikefest.org/form/afp.asp?formid=36" onSubmit="function () { if (validateemail()) { return xlaAFPvalidate(this); } return false; } ">
When you want to execute "xlaAFPvalidate" only when "validateemail" return true;
You could do following..define a inline function,
<form name="form1" method="post" action="http://www.pikefest.org/form/afp.asp?formid=36" onSubmit="function () { if (validateemail()) { return xlaAFPvalidate(this); } return false; } ">
Thanks, but ... why did you accept my answer? I think it did not work, and said so right below it. Then Roonaan explained some details I had not considered.
With all due respect, I think Roonaan deserved the 'A'.
Peace and joy. mvan
With all due respect, I think Roonaan deserved the 'A'.
Peace and joy. mvan
onsubmit="if(!validateEmai
-r-