Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session
SOLVED

selection from drop down list makes field visible

Avatar

Level 7

I have two drop down fields, the select in the first drop down field provides the list of items in the second drop down list. When an item in the second drop down list is selected, I want a hidden field to become visible.

I'm not sure how to write the script on the second drop down list to make the field visible. Here's the script I have, that's not working:

 

if (this.rawValue == "ACD");

 

{

agentID.presence = "visible";

}

if (this.rawValue == "Agent");

{

     agentID.presence = "hidden";

}

Thanks,

M.Dawn

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi Margaret,

Here is the corrected form https://acrobat.com/#d=D3yZytcriTw0pMp4S232Wg.

You had semi colons after the if statement (which was throwing it). Also I shortened the reference to the agentID object:

if (this.rawValue == "ACD") {

    agentID.presence = "visible";

}

else if (this.rawValue == "Agents") {

    agentID.presence = "hidden";

}

Good luck,

Niall

View solution in original post

10 Replies

Avatar

Level 10

Hi Margaret,

Which event have you used for the script? I would recommend the exit event of the second dropdown.

The script looks okay, but just make sure that the second dropdown has .rawValues of "ACD" and "Agent".

Also check the relative reference from the second dropdown to the agentID object. This may be full enough if they are separated by subforms.

Make sure the form is saved as a Dynamic XML Form in the save-as dialog.

Lastly, are there any errors in the JavaScript Console (Control+J when previewing), which would indicate a problem when interacting with the second dropdown?

Niall

Avatar

Level 7

Hi, Niall,

I’ve checked everything you listed and all items are set correctly. Would you have time to check the form itself?

Thanks,

Margaret Dawn

Avatar

Level 10

Hi Margaret,

If you upload your form to a file sharing site; publish it; and then post the published link here. I will look at it when I get a chance.

Niall

Avatar

Level 10

Hi Margaret,

It isn't published. You need to follow the steps below:

Acrobat.com publish.png

Niall

Avatar

Level 7

The link isn’t working for me. I’m not having much luck with technology things today!

Margaret Dawn

Avatar

Level 10
  • If you log back into Acrobat.com;
  • Select the file;
  • Either from the Share File menu at the bottom left, OR the dropdown menu from the file name, Click Publish;
  • Click OK through all the dialogs;
  • This will publish the form and make it available to anyone who clicks on the link above.

Good luck,

Niall

Avatar

Correct answer by
Level 10

Hi Margaret,

Here is the corrected form https://acrobat.com/#d=D3yZytcriTw0pMp4S232Wg.

You had semi colons after the if statement (which was throwing it). Also I shortened the reference to the agentID object:

if (this.rawValue == "ACD") {

    agentID.presence = "visible";

}

else if (this.rawValue == "Agents") {

    agentID.presence = "hidden";

}

Good luck,

Niall

Avatar

Level 2

I have a question.

Why does the else check for the alternative value of Agents?

The reason I ask is I have a similar problem with many alternatives in the dropdown.

In the case of "OTHER" being selected I need other fields to be visible.

In all other cases the fields in question should be invisible.

If the dropdown value is OTHER the fields 1a-4a should be invisible.

Why are we concerned with the value being something else?

I guess what I need is a statement that says if the value is not equal to "OTHER" then those fields are invisible.

I am trying this but I am not quite there:

In the change event of the 2nd dropdown.

if (BGR.rawValue == "OUT OF RANGE-DESCRIBE/COMMENT") {

    NOTEOOR.presence = "visible";

    RESULTS_OOR.presence = "visible";

    MU.presence = "visible";

    OOR_COMMENT.presence = "visible";

}

else if (BGR.rawValue <> "OUT OF RANGE-DESCRIBE/COMMENT") {

    NOTEOOR.presence = "hidden";

    RESULTS_OOR.presence = "hidden";

    MU.presence = "hidden";

    OOR_COMMENT.presence = "hidden";

}