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

Pre-populating a field based on 2 other fields

New Here ,
Aug 21, 2024 Aug 21, 2024

Copy link to clipboard

Copied

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!

Views

144

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 2 Correct answers

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.
...

Votes

Translate

Translate
Community Expert , Aug 21, 2024 Aug 21, 2024

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

Votes

Translate

Translate
Community Expert ,
Aug 21, 2024 Aug 21, 2024

Copy link to clipboard

Copied

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">

 

 

 

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

Copy link to clipboard

Copied

assuming this is an acrobat question.

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

Copy link to clipboard

Copied

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

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

Copy link to clipboard

Copied

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?

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

Copy link to clipboard

Copied

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

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

Copy link to clipboard

Copied

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

 

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

Copy link to clipboard

Copied

One more question...

 

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

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

Copy link to clipboard

Copied

LATEST

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

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