Alert based on drop down selection

Contributor ,
Dec 09, 2020

Copy link to clipboard

Copied

Really hoping I can get some help with this.  I attached an example of what I need.  If the user enters the hours FIRST in the RegHrs1 text field and then selects CDO (compressed day off) from the AbsencePayTypeDesc1 dropdown list, can an alert pop up that tells the user 'Do not enter hours' BUT if the user does NOT enter hours and then selects CDO (compressed day off) I don't need an alert to pop up.  Thank you!

TOPICS
Acrobat SDK and JavaScript

Views

97

Likes

Translate

Translate

Report

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

2 Correct Answers

Adobe Community Professional , Dec 09, 2020
ls_rbls Adobe Community Professional , Dec 09, 2020
I also wanted to add what worked for me:   I run a custom calculation script from the dropdown menu and deleted the validation scripts from both fields, as I found it wasn't exclusively necessary to use in this case.   var regHours = this.getField("RegHrs1"); var f = event.target; if ( regHours.value !=="") { if (f.valueAsString == "CDO (compressed day off)") { app.alert("Do Not Enter Hours", 0); //regHours.value = ""; this.resetForm(["RegHrs1"]); } else { if ( regHours.value == "" && f.value...

Likes

Translate

Translate
Jump to answer Jump to answer
Advocate , Dec 09, 2020
Nesa Nurani Advocate , Dec 09, 2020
I answerd you on your other post.Try this file and let me know if thats what you need.https://drive.google.com/uc?export=download&id=160hb6cB1jtNGXdwXIa9v3E449gxQS4-2 

Likes

Translate

Translate
Jump to answer Jump to answer
Advocate ,
Dec 09, 2020

Copy link to clipboard

Copied

I answerd you on your other post.

Try this file and let me know if thats what you need.

https://drive.google.com/uc?export=download&id=160hb6cB1jtNGXdwXIa9v3E449gxQS4-2 

Likes

Translate

Translate

Report

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

Copy link to clipboard

Copied

Yes, I saw thank you!  Sorry, I looked at my profile this morning and I couldn't find it.  I thought maybe it disappeared

Likes

Translate

Translate

Report

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

Copy link to clipboard

Copied

There is some issue going on with forum where posts keep dissapearing, not sure if it's bug or deliberately.

Likes

Translate

Translate

Report

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

Copy link to clipboard

Copied

I applied to my form and it works exactly how I need it to now.  Thank you so much for your help.  I really apprectiate it!!

Likes

Translate

Translate

Report

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

Copy link to clipboard

Copied

I also wanted to add what worked for me:

 

I run a custom calculation script from the dropdown menu and deleted the validation scripts from both fields, as I found it wasn't exclusively necessary to use in this case.

 

var regHours = this.getField("RegHrs1");
var f = event.target;

if ( regHours.value !=="") {

if (f.valueAsString == "CDO (compressed day off)") { app.alert("Do Not Enter Hours", 0);
//regHours.value = "";
this.resetForm(["RegHrs1"]);
} else {

if ( regHours.value == "" && f.valueAsString == "CDO (compressed day off)") { 
event.value = f.value;
  }
 }
}

Likes

Translate

Translate

Report

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

Copy link to clipboard

Copied

Nice!  Thank you very much!  I really appreciate your input!  I'll give it a try.

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
traceyc28668387 AUTHOR LATEST
Contributor ,
Dec 09, 2020

Copy link to clipboard

Copied

It works great, thank you!

Likes

Translate

Translate

Report

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