javascript - return false; onclick submit button not working -
If there is an error in my code, then I am trying to get my submit button to return false, But this is a broken page, I have tried in the console of Firefox and there are no errors. Thanks The return lies on the bottom code: Try this code and onsimet = "return search form (in form tag)"
function searchform ( ) {// To check all the boxes, whether any error is confirmed, FName (); ConfirmLName (); Confirm Email(); ConfirmAddress1 (); ConfirmAddress2 (); confirmCity (); confirmCode (); confirmUName (); confirm pass(); // Be sure to check that a region is selected (nhlForm.regbox == "select the country first", "select your country first") {// error message shows showMessage (nhlForm.regbox, "error", " * Select an area "); ShowMessage (nhlForm.counBox, "Error", "* Select a Country"); } // Check if checkbox is checked, if not, Messi will appear and will not send form (nhlForm.agebox.checked == true) {showMessage (nhlForm.agebox, "bingo", ""); } Else {// shows error message showMessage (nhlForm.agebox, "error", "you must have at least 14 accounts"); } If (nhlForm.checkbox.checked == true) {showMessage (nhlForm.checkbox, "bingo", ""); } else {// show error message showMessage (nhlForm.checkbox, "error", "you must accept the terms of use to continue"); } // If there are no errors, the form will be sent if (document.querySelectorAll (".error"). Length & gt; 0) {// Do not submit the form until the errors are returned false; }}
Function searchForm () {// Checks all the boxes to check whether any error is confirmed by FName (); ConfirmLName (); Confirm Email(); ConfirmAddress1 (); ConfirmAddress2 (); confirmCity (); confirmCode (); confirmUName (); confirm pass(); Var flag = true; // Be sure to check that one area is selected (nhlForm.regbox == "Choose Country First", "Choose Your Country First") {// Error message showsMessage shows (nhlForm.regbox, "error", " * Select an area "); ShowMessage (nhlForm.counBox, "Error", "* Select a Country"); Flag = false; } // Check if checkbox is checked, if not, Messi will appear and will not send form (nhlForm.agebox.checked == true) {showMessage (nhlForm.agebox, "bingo", ""); } else {// Show error message showMessage (nhlForm.agebox, "Error", "You must have at least 14 accounts"); Flag = false; } If (nhlForm.checkbox.checked == true) {showMessage (nhlForm.checkbox, "bingo", ""); } Else {// show error message showMessage (nhlForm.checkbox, "error", "you must accept the terms of use to continue"); Flag = false; } Return flag; }
Comments
Post a Comment