Skip to main content
Inspiring
Dec 8, 2020 7:03 PM UTC
Answered

Alert pop up with dropdown selection

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!

This topic is closed to new replies. Start a new post to keep the conversation going.
Nesa Nurani
Nesa NuraniCorrect answer
Community Expert
Dec 8, 2020 7:21 PM UTC

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 = "";}

6 replies

Inspiring
Dec 9, 2020 1:09 AM UTC

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  

Translate
Nesa Nurani
Community Expert
Community Expert
Dec 9, 2020 8:47 AM UTC

As calculation script try this:

 

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

Translate
Inspiring
Dec 9, 2020 4:35 PM UTC

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.

Translate
Nesa Nurani
Community Expert
Nesa NuraniCommunity ExpertCorrect answer
Community Expert
Dec 8, 2020 7:21 PM UTC

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 = "";}

Translate
Inspiring
Dec 8, 2020 7:23 PM UTC

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

Translate