Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}

var regex = /^[0-9]+(\.\d{1,2})?$/; // Allows positive integers or decimals

if (!regex.test(newValue) || newValue <= 0) {
g_form.setValue('amount', '');
g_form.showFieldMsg('amount', 'Please enter a amount greater than zero with decimals .Decimals are allowed here.', 'error');

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Purpose of this script:

It matches positive numbers (integers or decimals)
It does not match 0 or 0.0 (i.e., it excludes non-positive numbers).

So this regex is used when you want to allow only positive (> 0) integer or decimal values.
It will give us the field message error if anyone tries to enter anything apart from the allowed values
Loading