471,853 Members | 1,718 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,853 software developers and data experts.

onsubmit() Vs submit()

Is there any distinction between
1.when a form is submitted by onsubmit() in the <form> tag itself &
2.by any other function in onClick in the <form> tag which contains the
code for the form submit as
document.<form name>.submit();

Apr 20 '06 #1
1 6036
st*********@gmail.com said on 20/04/2006 4:43 PM AEST:
Is there any distinction between
1.when a form is submitted by onsubmit() in the <form> tag itself &
The onsubmit attribute provides script to execute when the submit event
occurs, it does not submit the form.

If the submit event returns false, submission is canceled. If scripting
is disabled or not available, or the script fails for some reason, the
form should be submitted.

2.by any other function in onClick in the <form> tag which contains the
code for the form submit as
document.<form name>.submit();


This calls the submit method of the form which is effectively the same
as clicking a submit button. However, if scripting is disabled or not
available, or the script fails for some reason, or the form's submit
method has been masked by a control named 'submit', the form will *not*
be submitted.

It is a bad idea to make submission reliant upon the successful
completion of a script.
--
Rob
Group FAQ: <URL:http://www.jibbering.com/FAQ>
Apr 20 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Stuart Wexler | last post: by
4 posts views Thread by Bruce Duncan | last post: by
2 posts views Thread by JM Rosengard | last post: by
2 posts views Thread by Sorrow | last post: by
NeoPa
reply views Thread by NeoPa | last post: by
reply views Thread by YellowAndGreen | last post: by
aboka
reply views Thread by aboka | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.