Allow negative amount in price field validation

The price field validation method in the admin js did not allow negative numbers, which are valid as eg. negative fees.
This commit is contained in:
Mike Martel 2014-04-17 12:51:02 +02:00
parent e0dc31620b
commit 5b81c7f320
1 changed files with 3 additions and 3 deletions

View File

@ -11,7 +11,7 @@ jQuery(function(){
jQuery('body').on('keyup change', '.wc_input_price[type=text]', function(){
var value = jQuery(this).val();
var regex = new RegExp( "[^0-9\%.\\" + woocommerce_admin.mon_decimal_point + "]+", "gi" );
var regex = new RegExp( "[^\-0-9\%.\\" + woocommerce_admin.mon_decimal_point + "]+", "gi" );
var newvalue = value.replace( regex, '' );
if ( value !== newvalue ) {
@ -28,9 +28,9 @@ jQuery(function(){
return this;
});
jQuery('body').on('keyup change', '.wc_input_price[type=text]', function(){
jQuery('body').on('keyup change', '.wc_input_decimal[type=text]', function(){
var value = jQuery(this).val();
var regex = new RegExp( "[^0-9\%.\\" + woocommerce_admin.decimal_point + "]+", "gi" );
var regex = new RegExp( "[^\-0-9\%.\\" + woocommerce_admin.decimal_point + "]+", "gi" );
var newvalue = value.replace( regex, '' );
if ( value !== newvalue ) {