Fixes : Quick Edit js validation added.

This commit is contained in:
nishitlangaliya 2015-10-08 13:07:24 +05:30
parent 02e2f2bf4d
commit eaa1058939
2 changed files with 16 additions and 1 deletions

View File

@ -221,4 +221,19 @@ jQuery( function ( $ ) {
// Attribute term table
$( 'table.attributes-table tbody tr:nth-child(odd)' ).addClass( 'alternate' );
// Add js validation for product quick edit
jQuery( ".regular_price, .sale_price" ).keyup(function() {
var value = jQuery( this ).val();
var regex = new RegExp( '[^\-0-9\%\\' + woocommerce_admin.mon_decimal_point + ']+', 'gi' );
var newvalue = value.replace( regex, '' );
if ( value !== newvalue ) {
jQuery( this ).val( newvalue );
jQuery( document.body ).triggerHandler( 'wc_add_error_tip', [ jQuery( this ), 'i18n_mon_decimal_error' ] );
} else {
jQuery( document.body ).triggerHandler( 'wc_remove_error_tip', [ jQuery( this ), 'i18n_mon_decimal_error' ] );
}
});
});

File diff suppressed because one or more lines are too long