Copy link to clipboard
Copied
Hi there,
I'm trying to create a form and want to add an If/Then statement, based on the value of another field within the form.
So, if the value of [field] = 1, then the value of the current field should = "X".
Does anyone know the syntax for that? (And I mean literally, if the value of a field = 1 then the value of the other field should be "X".
Thanks in advance for your help!
Copy link to clipboard
Copied
which adobe app? animate? acrobat? something else?
Copy link to clipboard
Copied
So sorry - Acrobat. 🙂
Copy link to clipboard
Copied
It looks like an employee evaluation form. So, my guess is Acrobat, and I will move the thread to the Acrobat forum.
Copy link to clipboard
Copied
Here you go:
if(this.getField("field").value == 1)event.value = "X";
Copy link to clipboard
Copied
Thank you! I appreciate it! 🙂
Copy link to clipboard
Copied
Hi Nesa,
I am trying the statement you provided (thanks again). However, I'm having this problem: On the Employee Review form, I need ONLY one specific box to contain an "X" based on the score they received for that category. BUT, the X is appearing in all boxes UP TO that score number (i.e., if the employee rated a 3, the form currently shows an X in the box for "1", "2", and "3" where the X should ONLY appear in the box for "3".
Here's the exact syntax I'm using;
if(this.getField("field").value == 3)event.value = "X"; [this in the "3" field value box only - in the "2 field value field, the statement is: if(this.getField("field").value == 2)event.value = "X"; same for fields 1, 4 and 5.
I can't figure out where I'm going wrong. Any ideas? Again, thanks so much for any guidance you can provide - this is clearly not my strong suit!
Copy link to clipboard
Copied
That's because you use the same field name in your scripts.
My script was just an example since I didn't know your field names, so change "field" with your actual field name.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Remove all scripts you have and use this one as custom calculation script of "QATIL" field instead:
for(var i=1; i<=5; i++){
if(event.value == i)
this.getField("QA"+i).value = event.value;
else
this.getField("QA"+i).value = "";}
Copy link to clipboard
Copied
Thank you. Unfortunately, now I'm completely lost. I tried using the script you provided as the custom calculation for the QATTL field, but now I get zero results. There are no scripts or calculations at all in QA1-QA5.
I'm unclear as to how this script pulls in the data from the appropriate section in the form. The data should come from Page 1, question 1 "Quality of Work". The calculation to be performed is on Page 4 in the Overall Performance Assessment section, first row.
Thanks again,
Donna Rae
Copy link to clipboard
Copied
Perhaps I misunderstand something.
if field "QOW1" equal 1 then field "QA1" equal X else "QA1" should be empty?
if field "QOW2" equal 2 then field "QA2" equal X else "QA2" should be empty...etc for other fields?
If yes, then use this as 'Validation' script of each "QOW" field,
in "QOW1" field use this:
this.getField("QA1").value = event.value == "1" ? "X" : "";
in "QOW2" field use this:
this.getField("QA2").value = event.value == "2" ? "X" : "";
Same for other fields.
Here is your file where I already made changes, let me know if it's something else you looking for:
https://drive.google.com/uc?export=download&id=1ggzgI9jVp0mzxRxadpAF87GUrr--_TIN
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Thank you Nesa,
Unfortunately, when I changed the score given in the "Quality of Work" area (Page 1, Item 1), the change was not reflected in the "Overall Performance Assessment" on Page 4 (see image attached).
It's been so long since I've been able to get to this that I can't remember what we've tried. One final attempt, if you have time and don't mind:
Is there a simpler statement that can just say, "If the value from the Total Score column = 1, the X should appear in the first column for this row. If the value from the Total Score column = 2, the X should appear in the second column for this row," and so on?