Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6e9fa6a

Browse files
authored
accept comma as decimal delimiter in payment form
fixes #16
1 parent ee0943b commit 6e9fa6a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

client/dist/javascript/omnipay-ui-cms.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
dialog.on("change, keyup", "input[type=text]", function () {
2929
var numVal = $(this).val();
3030
$("#PaymentDialog_ConfirmButton").button(
31-
numVal.match(/^\d+\.?\d*$/) && parseFloat(numVal) <= config.maxAmountNum ? "enable" : "disable"
31+
numVal.match(/^\d+[\.\,]?\d*$/) && parseFloat(numVal) <= config.maxAmountNum ? "enable" : "disable"
3232
);
3333
});
3434
}
@@ -56,6 +56,11 @@
5656
? ($("#PaymentDialog_AmountField").val() || "-1")
5757
: '';
5858

59+
//replace , with . in value if there is only one comma and no dot
60+
if (value.match(/,/g) && !value.match(/\./g) && value.match(/,/g).length == 1) {
61+
value = value.replace(/,/g, '.');
62+
}
63+
5964
self.getGridField().reload({
6065
data: [
6166
{name: self.attr('name'), value: self.val()},

0 commit comments

Comments
 (0)