Copy link to clipboard
Copied
This is my first post and I'm just starting out so please excuse my lack of knowledge. I can't figure out how to place a check mark in one of two fields automatically based on a calculated value compared to a range value. Any help is highly appreciated!
Copy link to clipboard
Copied
I 'm still trying to make this work and feel I'm close but still not there.
I can blank out the PASS field if a check mark is in the FAIL field but if I try to then add the script to blank out the FAIL field, it all stops working.
//PASS FIELD//
var VarianceRow1_2 = Number(this.getField("VarianceRow1_2").value);
if (VarianceRow1_2>-1.0 && VarianceRow1_2<1.0) event.value = resetForm(["FAILRow1_2"]);
if (VarianceRow1_2>=-1.0 && VarianceRow1_2<=1.0) event.value = "✔";
//FAIL FIELD//
var VarianceRow1_2 = Number(this.getField("VarianceRow1_2").value);
if (VarianceRow1_2<-1.0 || VarianceRow1_2>1.0) event.value = resetForm(["PASSRow1_2"]);
if (VarianceRow1_2<-1.0 || VarianceRow1_2>1.0) event.value = "✔";
Copy link to clipboard
Copied
I finally stumbled my way to the correct script. Whew! Learning by trial and error can be rough.
//PASS FIELD//
var VarianceRow1_2 = Number(this.getField("VarianceRow1_2").value);
if (VarianceRow1_2>=-1.0 && VarianceRow1_2<=1.0) event.value = "✔";
else event.value = resetForm(["PASSRow1_2"])
//FAIL FIELD//
var VarianceRow1_2 = Number(this.getField("VarianceRow1_2").value);
if (VarianceRow1_2<-1.0 || VarianceRow1_2>1.0) event.value = "✔";
else event.value = resetForm(["FAILRow1_2"])
Copy link to clipboard
Copied
It's not quite correct... This part is wrong:
VarianceRow1_2<-1.0
It should be:
VarianceRow1_2<=1.0
Also, I would advise against using the check-mark character in your code directly.
You can replace it with this:
String.fromCharCode(10004)
Copy link to clipboard
Copied
This is also wrong:
event.value = resetForm(["PASSRow1_2"])
If you want to clear the field use this, instead:
event.value = "";
Copy link to clipboard
Copied
Thank you TRY67. Especially for the String.fromCharCode(10004). Using a check mark was causing problems. I had no clue how to fix it. I guess since I'm completely new to Java scripts, I'll find a reference list of commands that can be used. Any suggestions?
Thanks again for your help!
Steve
Copy link to clipboard
Copied
That list is enormous. If you need help with something specific let us know and we'll help you out...