Skip to main content
Participant
July 5, 2022
Question

Drop Down

  • July 5, 2022
  • 3 replies
  • 402 views

If "employed" is selected in the dropdown, Make the employer name field required? How do I achieve this?

    This topic has been closed for replies.

    3 replies

    ls_rbls
    Community Expert
    Community Expert
    July 6, 2022

    ++Edited Reply (added "return.rc = true;" to the second example script

     

    Hi,

     

    You may be able to achieve that with a validation script or a custom calculation script.

     

    In the example below, I am running a  validation script event from the dropdown menu field:

     

     

     

     

    event.rc = true;
    
    if (event.value != "Employer") {
    
    this.getField("employer").required = false;
    
    } else {
    
    this.getField("employer").required = true;
    
    }
    
    
    

     

     

     

     

     

    A more concise, maybe more elegant way, with same result is shown below expressed in a single line of code:

     

     

     

    event.rc = true; (event.value != "Employer") ? this.getField("employer").required = false : this.getField("employer").required = true;

     

     

    try67
    Community Expert
    Community Expert
    July 6, 2022

    There's no need to add

    event.rc = true;

     

    ls_rbls
    Community Expert
    Community Expert
    July 7, 2022

    Thank you Try67.

     

    For some unknown reason to me the script wasn't working as intended without that line when used as validation script.

    Participant
    July 5, 2022

    I am using Adobe Acrobat Pro DC.

     

    John T Smith
    Community Expert
    Community Expert
    July 5, 2022

    When you post a question you always need to tell the Adobe program you are using
    There are MANY programs in a full subscription, plus other non-subscription programs
    Please post the exact name of the Adobe program you use so a Moderator may move this message to that forum