Copy link to clipboard
Copied
Novice Alert
I've got a field where I'm trying to provide some feedback text based on the answers in other fields, it's only partially working though. The custom calculation script is:
if(this.getField("Box 1").value == "Off") event.value = "";
if(this.getField("Box1").value == "Yes") event.value = "";
if(this.getField("Box 1").value == "No") event.value = "Feedback text 1.";
if(this.getField("Box 2").value == "Don't Know")event.value= "";
if(this.getField("Box 2").value == "Off") event.value = "";
if(this.getField("Box 2").value == "Yes") event.value = "";
if(this.getField("Box 2").value == "No") event.value = "Feedback text 2.";
if(this.getField("NonPassCarryingLiftsQuarterlyInspections").value == "Don't Know")event.value= "";
However, the field only displays Feedback text 1 and not feedback text 2
What am I doing wrong?
TIA
Copy link to clipboard
Copied
Check the JavaScript console for errors, and check that the field calculation order makes sense for how the form is set up. Note that the field calculation order is not the same thing as the tab order.
Copy link to clipboard
Copied
You need to clearly define the rules of how it should work, then write the code to implement those rules.
The way you have it now the value of Box 1 (which you misspelled in the second code line, by the way) is not likely to matter at all, because the conditions regarding Box 2 and "NonPassCarryingLiftsQuarterlyInspections" will overwrite any values that were assigned previously.
Copy link to clipboard
Copied
Thanks George.
How do I define the rules? I'm not great with JavaScript.. just trying to build a form for a colleague.