App Alert yes no buttons to show hide fields
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
