Committer: pkornilov
LJSUP-8153: no error when insert incorrect data to field "Card Verification Number"LJSUP-8152: no error when insert incorrect data to field "Card Number"
LJSUP-8155: disable State / Province if in Billing Country selected US
U trunk/htdocs/js/pay.js
Modified: trunk/htdocs/js/pay.js =================================================================== --- trunk/htdocs/js/pay.js 2011-03-15 09:18:47 UTC (rev 10236) +++ trunk/htdocs/js/pay.js 2011-03-15 10:46:02 UTC (rev 10237) @@ -448,20 +448,20 @@ input.data('is_focus', false); }); - jQuery([this.name_full, this.email]).input(function() - { - // keyboard no English - if (/[^a-z0-9!@#$%\^&*()_+\-=,.\/<>?;:'\\\[\] :"|]/i.test(this.value)) { - jQuery(this).closest('li') - .find('.b-bubble-lite').hide() - .end().find('.b-bubble-alert').show(); - } else { - jQuery(this).closest('li') - .find('.b-bubble-lite').show() - .end().find('.b-bubble-alert').hide(); - } - }); + jQuery([this.cc_num, this.cc_cvv2]).input(function() + { + if (/[^0-9]/.test(this.value)) { + this.value = this.value.replace(/[^0-9]/, ''); + } + }); + jQuery(this.country).change(function() { + var is_US = jQuery(this).val() === 'US'; + this.form.state.disabled = !is_US; + this.form.state_other.disabled = is_US; + }) + .change(); // init + // card type and American Express logic jQuery(this.type).change(function() { @@ -482,8 +482,7 @@ jQuery('#bubble_cc_num>span').html(cc_num_ml); jQuery('#bubble_cc_cvv2>span').html(cc_cvv2_ml); }) - // init - .change(); + .change(); // init }); } }