By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,636 Members | 1,181 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,636 IT Pros & Developers. It's quick & easy.

onsubmit not work if the submit is send by a function?

P: n/a
<form method="post" name="formWin" onSubmit="check();">

this work
only if I send the form's datas directly with <input type=submit ...>

if I use document.formWin.submit(); for to send the datas
onSubmit="check() not work more;

is there any solution?
Sep 18 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a

padew wrote:
<form method="post" name="formWin" onSubmit="check();">
Doing it this way will still not do what you would expect. It will
still submit the form. What you need to do is return a boolean which
signifies if the form would be submitted.

html:

<form method = "post" name - "formWin" onsubmit = "return check();">

js:

function check()
{
/*
return true if you want the form to be submitted
return false otherwise
*/
}
this work
only if I send the form's datas directly with <input type=submit ...>

if I use document.formWin.submit(); for to send the datas
onSubmit="check() not work more;

is there any solution?
If you wish to submit the form yourself, then in combination with the
above, you can do something like the following:

if(check())
{
document.forms["formWin"].submit();
}

Sep 18 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.