to restrict onchange client script to work when form loads
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-22-2024 03:41 AM
i have a catalog form with field x - which has some onload client script which sets the value to xyz. Now i want to run an onchange client which should throw an alert if any other value is entered other then xyz. so next time when i change the variable it should throw that alert not during the time form loads. Now it is throwing the alert the first time only when form loads
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-22-2024 04:57 AM
Hello @tanz ,
Does your catalog client script contain below line of code before your onChange logic?
if (isLoading || newValue == '') {
return;
}
Hope it helps.
If my response helps you in any way, kindly mark this as Accepted Solution/Helpful and help in closing this thread.
Regards,
Shubham
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-22-2024 05:00 AM
Here's the pseudocode for the answer I provided to your same question yesterday
onLoad Catalog Client Script - you must/should be doing something like this already:
1. call a Script Include via GlideAjax, passing a value from the client/form if necessary.
2. in the callback function, set the value of the variable to the answer received from the server.
onChange Catalog Client Script:
1. call the same Script Include via GlideAjax, passing a value from the client/form if necessary.
2. in the callback function, if the answer received from the server is not the same as the newValue, then alert..