Skip to content

Commit 789abbd

Browse files
committed
GH-1397 Added 6 digit voucher validation and disabled save button on failed validation.
1 parent 059fb81 commit 789abbd

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

laterpay/asset_sources/js/laterpay-backend-pricing.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -692,8 +692,7 @@
692692
validateVoucherCode = function( voucherInput, $wrapper, type ) {
693693
var voucherCode = voucherInput.val();
694694

695-
// Allows less than 6 Characters #1397
696-
if (voucherCode.length <= 6) {
695+
if (voucherCode.length === 6 ) {
697696
var globalVouchers = $o.globalVouchers.data.vouchers;
698697
if ( typeof $o.globalVouchers.data.vouchers === 'string' ) {
699698
globalVouchers = JSON.parse($o.globalVouchers.data.vouchers);
@@ -779,6 +778,8 @@
779778
} else {
780779
$wrapper.find('.lp_js_voucher_msg').text(lpVars.i18n.codeTooShort);
781780
$wrapper.find('.lp_js_voucher_msg').css('display', 'block');
781+
// Disabled save button if there are less than 6 characters. #1397
782+
$wrapper.find('.button-primary').attr('disabled', 'disabled');
782783
return;
783784
}
784785

0 commit comments

Comments
 (0)