onChange client script on 2 different fields interact with each other causing an error
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
Thanks in advance for your help!
I have 2 fields one takes a percentage of the base pay for an increase and the other takes a dollar amount of the increase.
We want the user to be able to fill one of the fields in and the onChange script will make the calculation to fill in the other.
The problem that I'm having is that if both scripts are Active, they trigger each other and then I get the following error:
onChange script error: SyntaxError: Invalid regular expression: /(^|[\x20\t\r\n\f])form-field([\x20\t\r\n\f]|$)/: Stack overflow function () { [native code] }
The information I've been able to find indicates that I'm running into Recursion. The suggested solution was to add newValue === oldValue as follows:

