Ticket #15204: 15204.diff
File 15204.diff, 2.2 KB (added by , 14 years ago) |
---|
-
wp-admin/js/common.dev.js
169 169 170 170 $(document).ready(function(){columns.init();}); 171 171 172 validateForm = function( form ) {173 return !$( form ).find('.form-required').filter( function() { return $('input:visible', this).val() == ''; } ).addClass( 'form-invalid' ).find('input:visible').change( function() { $(this).closest('.form-invalid').removeClass( 'form-invalid' ); } ).size();174 }175 176 172 })(jQuery); 177 173 178 174 // stub for doing better warnings -
wp-admin/js/tags.dev.js
29 29 $('#submit').click(function(){ 30 30 var form = $(this).parents('form'); 31 31 32 if ( ! validateForm( form ) )32 if ( !wpAjax.validateForm( form ) ) 33 33 return false; 34 34 35 35 $.post(ajaxurl, $('#addtag').serialize(), function(r){ -
wp-includes/js/wp-ajax-response.dev.js
50 50 return true; 51 51 }, 52 52 invalidateForm: function ( selector ) { 53 return jQuery( selector ).addClass( 'form-invalid' ).find('input:visible'). change( function() {jQuery(this).closest('.form-invalid').removeClass( 'form-invalid' ); } );53 return jQuery( selector ).addClass( 'form-invalid' ).find('input:visible').filter(':first').focus().end().change( function() { if(jQuery.trim(this.value)) jQuery(this).closest('.form-invalid').removeClass( 'form-invalid' ); } ); 54 54 }, 55 55 validateForm: function( selector ) { 56 56 selector = jQuery( selector ); 57 return !wpAjax.invalidateForm( selector.find('.form-required').filter( function() { return jQuery('input:visible', this).val() == ''; } ) ).size();57 return !wpAjax.invalidateForm( selector.find('.form-required').filter( function() { return jQuery('input:visible', this).val().trim() == ''; } ) ).size(); 58 58 } 59 59 }, wpAjax || { noPerm: 'You do not have permission to do that.', broken: 'An unidentified error has occurred.' } ); 60 60