Every line of 'jquery validate all input fields' 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.
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 }
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 }
64 function validate(input) { 65 let valid = validatePresence(input); 66 67 // TODO change this to using classList 68 $(input).removeClass('error'); 69 70 if (!valid) { 71 $(input).addClass('error'); 72 return false; 73 } 74 75 if ($(input).data('validation-type') === 'monetary') { 76 valid = validateMonetaryValue(input); 77 } 78 79 if (!valid) { 80 $(input).addClass('error'); 81 return false; 82 } 83 84 return true; 85 }
177 function validateForm() { 178 if ($("input#username").val() && $("input#password").val()) { 179 return true; 180 } else { 181 return false; 182 } 183 }
8 function validate_form_inputs( submittedForm ) { 9 10 var goodToGo = true; 11 var cntr = 1; 12 13 $( submittedForm ).find('.required').each( function( index ) { 14 if( $(this).val() === '' || $(this).val() === 0 ) { 15 $(this).addClass('requires-value').siblings( '.validation-notice-dv' ).fadeIn(); 16 goodToGo = false; 17 } 18 $(this).on( 'change', function() { 19 if( $(this).val() !== '' || $(this).val() !== 0 ) { 20 $(this).removeClass('requires-value').siblings( '.validation-notice-dv' ).fadeOut('fast'); 21 } 22 }); 23 if ( cntr === 1 ) { 24 var thisPos = $(this).offset(); 25 $(window).scrollTop( thisPos.top - 200 ); 26 } 27 cntr++; 28 }); 29 return goodToGo; 30 }
1 function validateForm(element) { 2 var result = true; 3 element.find('[required]').each( 4 function () { 5 var fieldElement = $(this); 6 //如果为null则设置为'' 7 var value = editor.getValue() || ''; 8 if (value) { 9 value = value.trim(); 10 } 11 if (!value || value === fieldElement.attr('data-placeholder')) { 12 alert((fieldElement.attr('data-name') || this.name) + "不能为空!"); 13 result = false; 14 return result; 15 } 16 } 17 ); 18 return result; 19 }
105 function validate_inputs(show_error = false){ 106 107 // Remove any existing errors and error highlights 108 remove_highlights(); 109 if(show_error) remove_errors(); 110 111 // "Clusters" 112 let valid = true; 113 if(!validate_number($("#clusters-input").val(), 1, active_document_count)){ 114 error_highlight("#clusters-input"); 115 if(show_error) error("Invalid number of clusters."); 116 valid = false; 117 } 118 119 // "Maximum Iterations" 120 if(!validate_number($("#maximum-iterations-input").val(), 1)){ 121 error_highlight("#maximum-iterations-input"); 122 if(show_error) error("Invalid number of maximum iterations."); 123 valid = false; 124 } 125 126 // "Different Centroids" 127 if(!validate_number($("#different-centroids-input").val(), 1)){ 128 error_highlight("#different-centroids-input"); 129 if(show_error) error("Invalid number of different centroids."); 130 valid = false; 131 } 132 133 // "Relative Tolerance" 134 if(!validate_number($("#relative-tolerance-input").val(), 0)){ 135 error_highlight("#relative-tolerance-input"); 136 if(show_error) error("Invalid relative tolerance."); 137 valid = false; 138 } 139 140 if(!validate_analyze_inputs(show_error, false)) valid = false; 141 return valid; 142 }
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 }
203 function validateForm () { 204 var valid = true; /* "true" is all good news */ 205 if ($.fn.validate === undefined) 206 return valid; 207 208 var validator = $top.validate(); 209 210 // Look at the inputs for each non-hidden step in our form 211 $("div.ui-dform-step:not(:hidden) input", $top).each(function () { 212 var tvalid = validator.element(this); 213 if (tvalid === undefined) // Agnostic? Force a value! 214 tvalid = true; 215 valid &= tvalid; 216 $.dbgpr("validateForm:", this.name, ":", tvalid); 217 }) 218 219 $.dbgpr("validateForm:", this.name, " is ", valid); 220 return valid; 221 }
111 function validate () 112 { 113 var validated = true; 114 $form.find('input:not(#submit-error)').each(function(i, e) 115 { 116 var valid = e.type === 'checkbox' 117 ? e.checked 118 : e.value !== ''; 119 if(!valid) 120 { 121 validated = false; 122 } 123 $(e) 124 .closest('.form-group') 125 .toggleClass('has-error', ! valid); 126 }); 127 return validated; 128 }