Highlighted

app.alert for custom dialog box

Contributor ,
Aug 10, 2020

Copy link to clipboard

Copied

I have fieldA  and button with custom dialog box.

How would I incorporate app.alert into dialog box so it stops dialog box to pop if value in fieldA is less then 5?

I know how to make code for app.alert:

if(this.getField("fieldA").value < 5){ app.alert("Need value of 5 or more");

I don't know how to put it inside dialog box so it stops it to execute.

Adobe Community Professional
Correct answer by BarlaeDC | Adobe Community Professional

Hi,

 

I am assuming you mean you want the dialog to show and no more code to be run. This can be achieved by using a if ... else

 

if ( this.getField("fieldA").value < 5) {
    app.alert ("Need value of 5 or more")
} else {
    //put code you want to run here when value is greated than 5
}

 Hope this helps

 

Malcolm

TOPICS
Acrobat SDK and JavaScript

Views

36

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

app.alert for custom dialog box

Contributor ,
Aug 10, 2020

Copy link to clipboard

Copied

I have fieldA  and button with custom dialog box.

How would I incorporate app.alert into dialog box so it stops dialog box to pop if value in fieldA is less then 5?

I know how to make code for app.alert:

if(this.getField("fieldA").value < 5){ app.alert("Need value of 5 or more");

I don't know how to put it inside dialog box so it stops it to execute.

Adobe Community Professional
Correct answer by BarlaeDC | Adobe Community Professional

Hi,

 

I am assuming you mean you want the dialog to show and no more code to be run. This can be achieved by using a if ... else

 

if ( this.getField("fieldA").value < 5) {
    app.alert ("Need value of 5 or more")
} else {
    //put code you want to run here when value is greated than 5
}

 Hope this helps

 

Malcolm

TOPICS
Acrobat SDK and JavaScript

Views

37

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Aug 10, 2020 0
Adobe Community Professional ,
Aug 10, 2020

Copy link to clipboard

Copied

Hi,

 

I am assuming you mean you want the dialog to show and no more code to be run. This can be achieved by using a if ... else

 

if ( this.getField("fieldA").value < 5) {
    app.alert ("Need value of 5 or more")
} else {
    //put code you want to run here when value is greated than 5
}

 Hope this helps

 

Malcolm

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 10, 2020 0
Contributor ,
Aug 10, 2020

Copy link to clipboard

Copied

I don't want dialog to show if value in fieldA is less then 5, in that case I want only alert to show and no dialog when I press on button.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 10, 2020 0
Adobe Community Professional ,
Aug 10, 2020

Copy link to clipboard

Copied

Hi,

 

In that case put the dialog code in the else section, would that not work?

 

Regards

 

Malcolm

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 10, 2020 0
Asim123 LATEST
Contributor ,
Aug 10, 2020

Copy link to clipboard

Copied

Yes that is working. Thanks

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 10, 2020 0