Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

app.alert for custom dialog box

Enthusiast ,
Aug 10, 2020 Aug 10, 2020

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.

TOPICS
Acrobat SDK and JavaScript
960
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Aug 10, 2020 Aug 10, 2020

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

Translate
Community Expert ,
Aug 10, 2020 Aug 10, 2020

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Aug 10, 2020 Aug 10, 2020

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 10, 2020 Aug 10, 2020

Hi,

 

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

 

Regards

 

Malcolm

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Aug 10, 2020 Aug 10, 2020
LATEST

Yes that is working. Thanks

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