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

Alert pop up with dropdown selection

Engaged ,
Dec 08, 2020 Dec 08, 2020

Copy link to clipboard

Copied

Hoping someone can help me with this.  I have a form with an Absence Type dropdown list and a text field to enter hours.  I would like to be able to have an alert pop up 'Do Not Enter Hours' if the user attempts to enter hours if CDO (compressed day off) is selected from the dropdown list.  I have attached a document showing an example of what I need.  Thank you!

TOPICS
Acrobat SDK and JavaScript

Views

1.4K

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
community guidelines

correct answers 1 Correct answer

Community Expert , Dec 08, 2020 Dec 08, 2020

You can try something like this in "Run custom validation script" of "RegHrs1" field:

if(this.getField("AbsencePayTypeDesc1").valueAsString == "CDO (compressed day off)"){
app.alert("Do Not Enter Hours");
event.value = "";}

Votes

Translate

Translate
Community Expert ,
Dec 08, 2020 Dec 08, 2020

Copy link to clipboard

Copied

You can try something like this in "Run custom validation script" of "RegHrs1" field:

if(this.getField("AbsencePayTypeDesc1").valueAsString == "CDO (compressed day off)"){
app.alert("Do Not Enter Hours");
event.value = "";}

Votes

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
community guidelines
Engaged ,
Dec 08, 2020 Dec 08, 2020

Copy link to clipboard

Copied

That's exactly what I need, works perfect!  Thank you!!

Votes

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
community guidelines
Engaged ,
Dec 08, 2020 Dec 08, 2020

Copy link to clipboard

Copied

Oh my, I just tried filling out my form and I didn't consider the user filling it the other way around.  Is there also a way to apply an alert if the user fills in the hours first and an alert pop up 'Do not enter hours' if they choose CDO from the dropdown list?  I updated my doc if it helps.

Votes

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
community guidelines
Engaged ,
Dec 08, 2020 Dec 08, 2020

Copy link to clipboard

Copied

It works if I run a calculation script in the dropdown menu if (event.value=="CDO (compressed day off)") app.alert("Do not enter hours",3);.  The only problem is I don't know how to set it up to only to pop up an alert if the user has entered hours when selecting CDO (compressed day off) from the drop down list or it will drive the user crazy.  If hours are left blank when selecting I don't need an alert.  So close!  Any help is greatly appreciated  

Votes

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
community guidelines
Community Expert ,
Dec 09, 2020 Dec 09, 2020

Copy link to clipboard

Copied

As calculation script try this:

 

if((event.value != "") && (this.getField("AbsencePayTypeDesc1").valueAsString == "CDO (compressed day off)")){ app.alert("Do Not Enter Hours"); event.value = "";}

Votes

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
community guidelines
Engaged ,
Dec 09, 2020 Dec 09, 2020

Copy link to clipboard

Copied

LATEST

Thank you, it works except the alert pops up every time the CDO selection is made from the Absence drop down.  I'm hoping it can only pop up if RegHrs1 text field has been filled in.  If it's been left blank I don't need the alert.  It will drive the user crazy if it pops up every time they select it.

Votes

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
community guidelines