onLoad Get Value Client Script Not Working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-04-2023 07:47 AM
Hi all,
Despite my best efforts using the getValue in a Client Script for onLoad, it does not seem to work
If the state is rejected, the alert should not trigger, yet it does.
I have tried several times, with different variations but no luck. Does anyone have a workaround on this?
Would be much appreciated.
Thank you

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-04-2023 07:59 AM
Instead of using || you need to use &&

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-04-2023 08:10 AM
Hi,
The condition you are evaluating is a bit off.
The state field value will be "rejected" ("Rejected" is the display value).
Mike suggested to switch from OR statement ("||") into and AND statement ("&&") but that won't work either, as long as you compare with both, the statement will never be true.
So change your condition into only checking the value, not the display value.
if (g_form.getValue('state') == 'rejected') {
// some code to run when state is rejected
}
else {
// optional some code to run when state is NOT rejected
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-04-2023 08:22 AM
Hi, for whatever reason Mike's solution works and the one suggested does not. I tried what you had suggested multiple times earlier with no luck. Thank you anyways!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-04-2023 08:42 AM
Yes, Mikes suggestion works, in the manner that the alert will not trigger.
But like I said earlier, that code will NEVER trigger the alert, because it will never evaluate to true if comparing to both "Rejected" AND "rejected"
Because the value is "rejected" so part one is always false, and part two is always true.
I changed the condition from "!=" into "==" and put in an else statement to use when the state is not rejected.
Thought you should know, use the solution you feel works best for you.