- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-17-2017 10:56 AM
Hello,
I cannot figure out how to get this "if" statement to work in a client script. I know it's a syntax issue, but I cannot figure it out.
This works:
if ((risk == '') && (changeType != 'Standard')) {
g_form.removeOption('state',2); // Sumbitted
}
This does not work (throws a compiler syntax error:
if ((risk == '') && (changeType != 'Standard')) || ((risk == '') && (changeType != 'Emergency')) {
g_form.removeOption('state',2); // Sumbitted
}
This does not work (Submitted option is removed)
if (((risk == '') && (changeType != 'Standard')) || ((risk == '') && (changeType != 'Emergency'))) {
g_form.removeOption('state',2); // Sumbitted
}
I also tried splitting it into two if statements, and that did not work.
Any ideas?
Thanks,
Laurie
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-17-2017 11:50 AM
WAIT!!!! Hang on to your hats ladies and gentlemen!!!
The solution is do not use "||" ! Use "&&"!
Thanks,
Laurie

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-17-2017 11:07 AM
if (risk == '' && changeType != 'Standard' || changeType != 'Emergency' ) {
g_form.removeOption('state',2); // Sumbitted
}
let me knw if this doesnt work
Harish

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-17-2017 11:16 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-17-2017 11:20 AM
Hi Harishkumar,
That did not work either. I also tried using "else if". This is an onLoad script.
Thank you,
Laurie

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-17-2017 11:22 AM
Can you post your entire script here?
Harish