Skip to main content
Participant
August 21, 2024
Answered

Pre-populating a field based on 2 other fields

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!

    This topic is closed to new replies. Start a new post to keep the conversation going.
    try67
    try67Correct answer
    Community Expert
    August 21, 2024

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

    8 replies

    try67
    Community Expert
    Community Expert
    August 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
    Participant
    August 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
    try67
    Community Expert
    try67Community ExpertCorrect answer
    Community Expert
    August 21, 2024

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

    Translate
    kglad
    Community Expert
    Community Expert
    August 21, 2024

    assuming this is an acrobat question.

    Translate
    kglad
    Community Expert
    Community Expert
    August 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