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

Pre-populating a field based on 2 other fields

New Here ,
Aug 21, 2024 Aug 21, 2024

I want to pre-populate a text field (Hiring Salary Range) based on the drop-down choice (Pay Grade) and radio button choice (Exempt/Non-Exempt). Please help!

479
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
2 ACCEPTED SOLUTIONS
Community Expert ,
Aug 21, 2024 Aug 21, 2024

You can use something like this as the custom calculation script of that field (adjust the values as needed):

 

var payGrade = this.getField("Pay Grade").valueAsString;
var exempt = this.getField("Exempt").valueAsString;

if (payGrade=="1" && exempt=="Exempt") event.value = 1000;
else if (payGrade=="1" && exempt=="Non-Exempt") event.value = 1200;
else if (payGrade=="2" && exempt=="Exempt") event.value = 2000;
else if (payGrade=="2" && exempt=="Non-Exempt") event.value = 2400; // etc.
else event.value = "";

View solution in original post

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 21, 2024 Aug 21, 2024

You have to put quotes around strings, such as: "$24,774 - $37,161"

View solution in original post

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 21, 2024 Aug 21, 2024

in the future, to find the best place to post your message, use the list here, https://community.adobe.com/

p.s. i don't think the adobe website, and forums in particular, are easy to navigate, so don't spend a lot of time searching that forum list. do your best and we'll move the post (like this one has already been moved) if it helps you get responses.



<"moved from using the community">

 

 

 

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 21, 2024 Aug 21, 2024

assuming this is an acrobat question.

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 21, 2024 Aug 21, 2024

You can use something like this as the custom calculation script of that field (adjust the values as needed):

 

var payGrade = this.getField("Pay Grade").valueAsString;
var exempt = this.getField("Exempt").valueAsString;

if (payGrade=="1" && exempt=="Exempt") event.value = 1000;
else if (payGrade=="1" && exempt=="Non-Exempt") event.value = 1200;
else if (payGrade=="2" && exempt=="Exempt") event.value = 2000;
else if (payGrade=="2" && exempt=="Non-Exempt") event.value = 2400; // etc.
else event.value = "";
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
New Here ,
Aug 21, 2024 Aug 21, 2024

I could not get the checkboxes to work, so I changed them to drop-down lists. Following this as a guide, I created this string, which is not working:

 

var PayGrade = this.getField("Pay Grade").valueAsString;

var Status = this.getField ("Status").valueAsString;

var Hours = this.getField("Hours").valueAsString;

if (PayGrade=="57"&& Status=="Exempt" && Hours=="Full-Time")event.value = $24,774 - $37,161; else if (PayGrade=="57"&& Status=="Non-Exempt" && Hours== "Full-Time")event.value = $11.91 - $17.87; else event.value = "See Attached";

 

It tells me there is a syntax error missing before statement 7: at line 8.

I am adding this script in the "Custom calculation script" field under the "Calculate" tab in the Properties of the field where I want the result. 

 

Basically, I have a list of Pay Grades, that have different Salary Ranges based on full-time or part-time. I'm trying to auto-populate the Salary Range field based on the answers of the 3 drop downs - Pay Grade, Status, and Hours.

 

I think I'm close, but it's not quite there yet...

Suggestions?

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 21, 2024 Aug 21, 2024

You have to put quotes around strings, such as: "$24,774 - $37,161"

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
New Here ,
Aug 21, 2024 Aug 21, 2024

Thanks so much for your quick response. It worked perfectly!!

 

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
New Here ,
Aug 21, 2024 Aug 21, 2024

One more question...

 

If they choose "Exempt" under Status, can I force "Hours" to auto-populate with "Full-Time", thereby auto-populating "Salary Range"?

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
New Here ,
Aug 21, 2024 Aug 21, 2024
LATEST

I figured it out - you have been a great guide!

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