Skip to content

Commit

Permalink
netteForms: converts float & int to numbers [Closes #313]
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Feb 25, 2024
1 parent 0c10ca6 commit 02a1f91
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/assets/netteForms.js
Original file line number Diff line number Diff line change
Expand Up @@ -478,14 +478,18 @@
return (/^[0-9]+$/).test(val);
},

integer: function(elem, arg, val) {
return (/^-?[0-9]+$/).test(val);
integer: function(elem, arg, val, value) {
if ((/^-?[0-9]+$/).test(val)) {
value.value = parseFloat(val);
return true;
}
return false;
},

'float': function(elem, arg, val, value) {
val = val.replace(/ +/g, '').replace(/,/g, '.');
if ((/^-?[0-9]*\.?[0-9]+$/).test(val)) {
value.value = val;
value.value = parseFloat(val);
return true;
}
return false;
Expand Down

0 comments on commit 02a1f91

Please sign in to comment.