Every line of 'onsubmit form validation' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.
32 function validateForm() { 33 var user = document.forms["myForm"]["user"].value; 34 35 if(user.trim() == "") { 36 document.getElementById("userError").innerHTML = "Remplir le champ svp !"; 37 return false; 38 } 39 return true; 40 }
177 function validateForm() { 178 if ($("input#username").val() && $("input#password").val()) { 179 return true; 180 } else { 181 return false; 182 } 183 }
86 function validate(form) { 87 if(jQuery("#access_id").val() == '') { 88 jQuery("#access_id").parent().parent().addClass('has-warning'); 89 return false; 90 } else if(jQuery("#access_key").val() == '') { 91 jQuery("#access_key").parent().parent().addClass('has-warning'); 92 return false; 93 } else if(jQuery("#bucket").val() == '') { 94 jQuery("#bucket").parent().parent().addClass('has-warning'); 95 return false; 96 } else if(jQuery("#hostname").val() == '') { 97 jQuery("#hostname").parent().parent().addClass('has-warning'); 98 return false; 99 } 100 return true; 101 }
85 function validate(form) { 86 var i = 0; 87 jQuery("input.required").each(function() { 88 if(jQuery(this).val() == '') { 89 jQuery(this).focus(); 90 return false; 91 } 92 i++; 93 }); 94 if(i < jQuery("input.required").length) { 95 return false; 96 } else { 97 return true; 98 } 99 }
22 validateForm() { 23 return this.state.username.length > 0 && this.state.password.length > 0 && this.state.confirmPassword.length > 0 && this.state.password === this.state.confirmPassword; 24 }
17 function validateForm() 18 { 19 var message = ""; 20 var returnValue = true; 21 var fm = document.getElementById("fm"); 22 if(fm.firstName.value == "") 23 { 24 message += "- The field First Name is Mandatory \n"; 25 returnValue = false; 26 } 27 if(fm.lastName.value == "") 28 { 29 message += "- The field Last Name is Mandatory \n"; 30 returnValue = false; 31 } 32 if(fm.email.value == "") 33 { 34 message += "- The field Email is Mandatory \n"; 35 returnValue = false; 36 } 37 if(!returnValue) 38 { 39 message = "Please correct the following errors:\n\n" + message; 40 alert(message); 41 } 42 return returnValue; 43 }
56 function validateForm () { 57 if (checkField('#name', 'Name') && 58 checkField('#email', 'Email') && 59 checkEmail('#email') && 60 checkField('#message', 'Message')) { 61 return true; 62 } 63 return false; 64 }
205 function validateForm(form) { 206 if (form.elements[0].value.length === 0) { 207 const $form = $(form); 208 if (!$form.hasClass('errors')) { 209 $form 210 .addClass('errors') 211 .find('input') 212 .addClass('error') 213 .attr('aria-invalid', 'true'); 214 $( 215 `<div>${Drupal.t( 216 'Please provide a name for the button group.', 217 )}</div>`, 218 ).insertAfter(form.elements[0]); 219 } 220 return true; 221 } 222 return false; 223 }
50 function validateForm(){ 51 var form = document.forms["signup"]; 52 53 var result = validate({ 54 "email": form["email"].value, 55 "name": form["name"].value, 56 "password": form["password"].value, 57 "confirmPassword": form["confirm_password"].value, 58 "englishName": form["english_name"].value, 59 "class": form["class"].value 60 }, constraints, {fullMessages: false}); 61 62 if(!!result){ 63 // alert only first error message. 64 alert(result[Object.keys(result)[0]][0]); 65 return false; 66 } else { 67 return true; 68 } 69 }
8 function validateForm(f) 9 { 10 if ((!f.scm_integration[0].checked) && (!f.scm_integration[1].checked)) { 11 alert('{/literal}{t escape=js}Please choose whether the SCM integration feature should be enabled or not.{/t}{literal}'); 12 return false; 13 } 14 if (f.scm_integration[0].checked) { 15 field = getFormElement(f, 'checkout_url'); 16 if (isWhitespace(field.value)) { 17 alert('{/literal}{t escape=js}Please enter the checkout page URL for your SCM integration tool.{/t}{literal}'); 18 selectField(f, 'checkout_url'); 19 return false; 20 } 21 field = getFormElement(f, 'diff_url'); 22 if (isWhitespace(field.value)) { 23 alert('{/literal}{t escape=js}Please enter the diff page URL for your SCM integration tool.{/t}{literal}'); 24 selectField(f, 'diff_url'); 25 return false; 26 } 27 field = getFormElement(f, 'scm_log_url'); 28 if (isWhitespace(field.value)) { 29 alert('{/literal}{t escape=js}Please enter the log page URL for your SCM integration tool.{/t}{literal}'); 30 selectField(f, 'scm_log_url'); 31 return false; 32 } 33 } 34 return true; 35 }