Copy link to clipboard
Copied
I want to pull a value from a field and perform calculations on it but if the field contains any non-numeric characters I want it to do nothing.
You can use a regular expression for this. For example:
var v = this.getField("Text1").valueAsString;
if (/\D/.test(v)) {
// the field contains non-numeric characters
} else {
// the field is empty or contains only numeric characters}
Copy link to clipboard
Copied
I want to pull a value from a field and perform calculations on it but if the field contains any non-numeric characters I want it to do nothing.
You can use a regular expression for this. For example:
var v = this.getField("Text1").valueAsString;
if (/\D/.test(v)) {
// the field contains non-numeric characters
} else {
// the field is empty or contains only numeric characters}
Copy link to clipboard
Copied
You can use a regular expression for this. For example:
var v = this.getField("Text1").valueAsString;
if (/\D/.test(v)) {
// the field contains non-numeric characters
} else {
// the field is empty or contains only numeric characters}