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
Solved! Go to Solution.
Views
Replies
Total Likes
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
Views
Replies
Total Likes
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
Views
Replies
Total Likes
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
Views
Replies
Total Likes
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
Views
Replies
Total Likes
Views
Replies
Total Likes
Hi Margaret,
It isn't published. You need to follow the steps below:
Niall
Views
Replies
Total Likes
The link isn’t working for me. I’m not having much luck with technology things today!
Margaret Dawn
Views
Replies
Total Likes
Good luck,
Niall
Views
Replies
Total Likes
https://acrobat.com/#d=1Kf-jXFMQIDYkIJCl5CEEA
I got the steps this time that you mentioned.
Margaret Dawn
Views
Replies
Total Likes
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
Views
Replies
Total Likes
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";
}
Views
Replies
Total Likes
Views
Likes
Replies