Copy link to clipboard
Copied
Hi All - first post here on the Adobe forums, hopefully someone cleverer than I can help!
I’m designing a PDF form for electronic completion.
The client needs a pop up message to appear if particular choices are made from two drop-down menu fields, for arguments sake lets call them Field1 and Field2.
I‘ve nearly manged to get this working nicely using a run JAVA script action upon exit/blur from Field2, however I only know how to trigger the pop-up message based on the entry value of Field2 - see an example of the code I have running now below;
if (getField"Field2").value=="1") app.alert({ cMsg: "Dialogue message here", cTitle: "Message Window Title Here", nIcon: 3, nType: 0 });
However, I don’t know how to write the script to include the condition of Field1, effectively saying ‘if (getField"Field1").value=="1") AND if (getField"Field2").value=="1") THEN run the app alert’ - if that makes sense!
Is anyone able to help?
Many thanks in advance!
Use this:
if (this.getField("Field2").value=="1" && this.getField("Field1").value=="1") ...
Copy link to clipboard
Copied
Exactly like that, only by using the correct AND logical operator, which in JS is "&&", so:
if (this.getField"Field2").value=="1" && this.getField"Field1").value=="1") ...
Copy link to clipboard
Copied
try67 - thank you for your assistance. I'm an absolute novice when it comes to JS, but I did some research and did think '&&' must be part of the solution but couldn't get it to work!
Based on your advice, I've just tried the following:
if (this.getField"Field1").value=="1" && this.getField"Field2").value=="1") app.alert({cMsg: "Pop-up Message Here", cTitle: "Window Title Here", nIcon: 3, nType: 0});
However I cannot commit the script - I'm getting "SyntaxError: missing ) after condition 1: at line 2" - any ideas?
Thanks again
Copy link to clipboard
Copied
Use this:
if (this.getField("Field2").value=="1" && this.getField("Field1").value=="1") ...
Copy link to clipboard
Copied
Bernd Alheit you are a hero - perfect.
Many thanks all!