Copy link to clipboard
Copied
I have looked through the community and have seen an old post relating to yes no buttons on an app alert and have managed to get 90% of the code working for my requirements.
I have also read through https://acrobatusers.com/tutorials/popup_windows_part1/
In my form I have a drop down field that will show hide other fields. If the drop down 'yes' is selected then I have an app alert pop up with a Yes and No button. Depending on which button is selected I have a further set of fields which id like to be made visible/hidden
if(event.value == "select") {
this.getField("Group1234").display=display.hidden;
this.getField("Group12345").display=display.hidden;
}
else if(event.value == "no") {
this.getField("Group1234").display=display.hidden;
this.getField("Group12345").display=display.hidden;
else if(event.target.value == "yes"){
var nRslt = app.alert ("If this is an out of area deal, do you require the Logbook first being registered to *** LTD?\n\nIf 'Yes' please make sure the customer is aware they will not be the first keeper on the logbook.",2,2);
if(nRslt == 4)
this.getField("Group1234").display=display.hidden;
this.getField("Group12345").display=display.visible;
}else{
this.getField("Group1234").display=display.visible;
this.getField("Group12345").display=display.hidden;
}
The app alert triggers correctly but when either Yes or No are clicked Group12345 becomes visible. I have noted in the link above that each of the buttons has its own return value and I have also tried amending the code to
if(nRslt == 3) //Yes
this.getField("Group1234").display=display.hidden;
this.getField("Group12345").display=display.visible;
else if(nRslt == 2) //No
this.getField("Group1234").display=display.visible;
this.getField("Group12345").display=display.hidden;
However this throws up a syntax error with the else if(nRslt == 2) line
Any help witht his would be greatly appreciated as im sure its a simple issue that i just cannot see
[Sighs] - Trying my hardest to learn all this
Copy link to clipboard
Copied
The second curly bracket should be moved to the end of the script:
if(event.target.value == "yes"){
var nRslt = app.alert ("If this is an out of area deal, do you require the Logbook first being registered to *** LTD?\n\nIf 'Yes' please make sure the customer is aware they will not be the first keeper on the logbook.",2,2);
if(nRslt == 4){
this.getField("Group1234").display=display.hidden;
this.getField("Group12345").display=display.visible;}
else{
this.getField("Group1234").display=display.visible;
this.getField("Group12345").display=display.hidden;}}
Copy link to clipboard
Copied
Put 'if(nRslt == 4) condition inside curly brackets.
Copy link to clipboard
Copied
Hi Nesa,
Apologies, i dont have much coding experience. Do you mean like this as i still get an error
else if(event.target.value == "yes"){
var nRslt = app.alert ("If this is an out of area deal, do you require the Logbook first being registered to P A Turney LTD?\n\nIf 'Yes' please make sure the customer is aware they will not be the first keeper on the logbook.",2,2);
{if(nRslt == 4)
this.getField("Group1234").display=display.hidden;
this.getField("Group12345").display=display.visible;
}else{
this.getField("Group1234").display=display.visible;
this.getField("Group12345").display=display.hidden;
}
}
[Sighs] - Trying my hardest to learn all this
Copy link to clipboard
Copied
Try this:
if(event.target.value == "yes"){
var nRslt = app.alert ("If this is an out of area deal, do you require the Logbook first being registered to *** LTD?\n\nIf 'Yes' please make sure the customer is aware they will not be the first keeper on the logbook.",2,2);
if(nRslt == 4){
this.getField("Group1234").display=display.hidden;
this.getField("Group12345").display=display.visible;}}
else{
this.getField("Group1234").display=display.visible;
this.getField("Group12345").display=display.hidden;}
Copy link to clipboard
Copied
Hi Nesa,
Again Thank you for your help.
When selecting Yes Group12345 is visible which is correct, however when selecting No Neither Group1234 (should be visible) or Group 12345 are visible
[Sighs] - Trying my hardest to learn all this
Copy link to clipboard
Copied
The second curly bracket should be moved to the end of the script:
if(event.target.value == "yes"){
var nRslt = app.alert ("If this is an out of area deal, do you require the Logbook first being registered to *** LTD?\n\nIf 'Yes' please make sure the customer is aware they will not be the first keeper on the logbook.",2,2);
if(nRslt == 4){
this.getField("Group1234").display=display.hidden;
this.getField("Group12345").display=display.visible;}
else{
this.getField("Group1234").display=display.visible;
this.getField("Group12345").display=display.hidden;}}
Copy link to clipboard
Copied
Hi Nesa,
Thank you so much. No you have pointed it out it is glaringly obvious.
Thank you again for you assistance with this.
[Sighs] - Trying my hardest to learn all this

