469,282 Members | 1,743 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,282 developers. It's quick & easy.

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 5495
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
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.