Skip to main content
Stack Overflow
  1. About
  2. For Teams

Return to Question

I have a quick question that should actually be really simple but I haven’t been able to find it online through MANY searches. I have an HTML form and a submit button. In the form, I have an ‘onsubmit()’ event which does validation. How do I call a submit function after I return my onsubmit value if true do ‘thissubmit()’ I currently have a onsubmit function() If my function returns true then I call - document.forms["formsignin"].submit(); return true; That goes to my jQuery ‘$(myForm).on("submit", function () {}’ I want to do this in Javascript ONLY and NOT with the $(myform).on() jQuery way.

Sign in

Function validateit() { do validation stuff if(....){document.forms["formsignin"].submit(); return true;

$(myForm).on("submit", function () {

<form id="fsignin" onsubmit="return validateit();">
<button type="submit">Sign in</button>
</form>
Function validateit() { 
do validation stuff if(....){document.forms["formsignin"].submit(); return true;
$(myForm).on("submit", function () { 
 if (validateit()) {
 }
}

}

I have a quick question that should actually be really simple but I haven’t been able to find it online through MANY searches. I have an HTML form and a submit button. In the form I have an ‘onsubmit()’ event which does validation. How do I call a submit function after I return my onsubmit value if true do ‘thissubmit()’ I currently have a onsubmit function() If my function returns true then I call - document.forms["formsignin"].submit(); return true; That goes to my jQuery ‘$(myForm).on("submit", function () {}’ I want to do this in Javascript ONLY and NOT with the $(myform).on() jQuery way.

Sign in

Function validateit() { do validation stuff if(....){document.forms["formsignin"].submit(); return true;

$(myForm).on("submit", function () {

if (validateit()) {}

}

I have a quick question that should actually be really simple but I haven’t been able to find it online through MANY searches. I have an HTML form and a submit button. In the form, I have an ‘onsubmit()’ event which does validation. How do I call a submit function after I return my onsubmit value if true do ‘thissubmit()’ I currently have a onsubmit function() If my function returns true then I call - document.forms["formsignin"].submit(); return true; That goes to my jQuery ‘$(myForm).on("submit", function () {}’ I want to do this in Javascript ONLY and NOT with the $(myform).on() jQuery way.

<form id="fsignin" onsubmit="return validateit();">
<button type="submit">Sign in</button>
</form>
Function validateit() { 
do validation stuff if(....){document.forms["formsignin"].submit(); return true;
$(myForm).on("submit", function () { 
 if (validateit()) {
 }
}
Source Link

Javascript on submit function

I have a quick question that should actually be really simple but I haven’t been able to find it online through MANY searches. I have an HTML form and a submit button. In the form I have an ‘onsubmit()’ event which does validation. How do I call a submit function after I return my onsubmit value if true do ‘thissubmit()’ I currently have a onsubmit function() If my function returns true then I call - document.forms["formsignin"].submit(); return true; That goes to my jQuery ‘$(myForm).on("submit", function () {}’ I want to do this in Javascript ONLY and NOT with the $(myform).on() jQuery way.

Sign in

Function validateit() { do validation stuff if(....){document.forms["formsignin"].submit(); return true;

$(myForm).on("submit", function () {

if (validateit()) {}

}

lang-js

AltStyle によって変換されたページ (->オリジナル) /