Skip to main content
jonathanm75257324
Known Participant
October 3, 2018
Answered

Spawn/Delete Functionality to an App.Alert

  • October 3, 2018
  • 1 reply
  • 1285 views

I'm using a bit of complex code (and I'm trying to stay away from global variables) to have a checkbox within an app.alert window that upon click wound spawn a template. I have both codes (one for the app.alert with checkbox, and one for the spawn/delete) but cannot seem to link the two together well. Any help would be greatly appreciated.

App.Alert Code [Based on a dropdown value] :

{var oCk = {cMsg:"Yes, I want to add a form to this document", bInitialValue:true, bAfterValue:false};

    app.alert({cMsg:" Do you want to add a form to this document?", nIcon:3, oCheckbox:oCk, cTitle:"TDR?"});

    }

Spawn/Delete Code [To be triggered upon click of app.alert check]:

if (this.getField("Checkbox").value == "Off")

{

    oFld = this.getField("Additional NotesComments");

    this.deletePages(oFld.page[1]);

}

else

{

    var a = this.getTemplate("Form");

    a.spawn(1, false, false);

}

Let me know if you can help!

This topic has been closed for replies.
Correct answer try67

Like this:

if (app.alert("Do you want to add a form to this file?",2,2)==4) {

    // put code to spawn page here

}

1 reply

try67
Community Expert
Community Expert
October 3, 2018

You'll be better off using a "Yes/No" alert, instead.

On 4 October 2018 at 00:55, jonathanm75257324 <forums_noreply@adobe.com>

jonathanm75257324
Known Participant
October 3, 2018

Any insight on how to do it as a yes/no alert would be greatly appreciate. My main issue is linking the code.

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
October 3, 2018

Like this:

if (app.alert("Do you want to add a form to this file?",2,2)==4) {

    // put code to spawn page here

}