- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2024 08:57 PM
I have an onSubmit Client Script that I need to perform several validation checks on if the variables changed.
How can I script:
If State changes to In Progress
I'm unable to use an onChange Client Script for this scenerio.
Help is greatly appreciated!!
Thank you,
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2024 09:07 PM
Hi,
Write the onChange client script on State field and add below code.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2024 09:27 PM - edited 03-21-2024 09:27 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2024 04:17 AM
I need to keep the OnSubmit Client Script, as a UI Action is affecting this.
If the State changes, I need to have another validation and display a pop up window.
I just need help on "If the State changes to a certain state"
Can you help?
Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2024 06:16 AM
I tried the OnChange Client Script and it allows the pop up window to come up. But when I click "Yes" to confirm it takes me to a New Record and does not save the form changes on the record I was on.
I'm using GlideModel with this function.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2024 11:01 PM
You can write onchange client script on state field, Below is the sample code:
function onChangeState(control, oldValue, newValue, isLoading) {
if (isLoading || newValue === '') {
return;
}
// Check if the new state is "In Progress"
if (newValue === '2') { // Assuming '2' represents "In Progress"
// Perform validation checks
// Display an error message
alert('Validation failed. Please check your data.');
// Revert the value to the old value
g_form.setValue('state', oldValue);
}
}
Please Mark ✅Correct if this solves your query and also mark 👍Helpful if you find my response worthy based on the impact.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2024 04:13 AM
I need to keep the OnSubmit Client Script, as a UI Action is affecting this.
Can you help?
Thank you