Skip to main content
Inspiring
December 8, 2020
Answered

Alert pop up with dropdown selection

  • December 8, 2020
  • 2 replies
  • 2658 views

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 has been closed for replies.
Correct answer Nesa Nurani

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

2 replies

Inspiring
December 9, 2020

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  

Nesa Nurani
Community Expert
Community Expert
December 9, 2020

As calculation script try this:

 

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

Inspiring
December 9, 2020

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.

Nesa Nurani
Community Expert
Nesa NuraniCommunity ExpertCorrect answer
Community Expert
December 8, 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 = "";}

Inspiring
December 8, 2020

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