Copy link to clipboard
Copied
Hi, Sorry I am a noob
I have a situation like this
If a work is deemed to be VH or H (Very high or High) Risks, the employee is not allowed to work after hours.
So I want the checkbox "Not allowed" to be checked when R (Risk) is displayed as VH or H and lock the "Allowed" and "Monitor Only" checkboxes.
So far this is what I have done but it does not seem to perform what I expected:
1) Set up a JavaScript under Actions
2) The following script in the "Not Allowed" checkbox
var R = this.getField("Risk").valueAsString;
if(R=="H"||R=="VH"){event.value = "Yes";}
Copy link to clipboard
Copied
Copy link to clipboard
Copied
You can't use the check-box's actions for that. Use the custom Validation script of the Risk field, instead, with this code:
var R = event.value;
this.getField("Not Allowed").checkThisBox(0, (R=="H" || R=="VH"));
Copy link to clipboard
Copied
Thank you for this.
I already have the following script in the Risk Field (R). Can you advice how to add your script on top of my existing script in the Risk Field (R)?
var L = this.getField("LReaction").valueAsString;
var C = this.getField("CReaction").valueAsString;
var R = L+C;
if(R=="A1"||R=="B1"||R=="B2"||R=="C2"||R=="D3"||R=="D4"||R=="E3"||R=="E4"||R=="E5")
event.value = "M";
else if(R=="C1"||R=="D1"||R=="D2"||R=="E1"||R=="E2")
event.value = "L";
else if(R=="A2"||R=="A3"||R=="B3"||R=="B4"||R=="C3"||R=="C4"||R=="D5")
event.value = "H";
else if(R=="A4"||R=="A5"||R=="B5"||R=="C5")
event.value = "VH";
else
event.value = "";
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Thanks a lot for this!