Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Drop Down Box

Avatar

Former Community Member

Hello,

I have a drop down box with 5 options. 1)Self 2)Spouse 3)Parent/Guardian 4)Power of Attorney 5)Other.  I have specified the item values, so that each option has a number. When the user chooses option 5 I would like another field to appear (which is currently hidden). This is the script I have used, which is not working:

Under the change event:

if(this.rawValue == "5"

{formcompletedby.specifyother.presence = "visible";

}else{

formcompletedby.specifyother.presence = "hidden";}

Under the click event:

if(relationship.rawValue == "5")

{formcompletedby.specifyother.presence = "visible";

formcompletedby.specifyother.mandatory = "error";

}else{

formcompletedby.specifyother.presence = "hidden";

formcompletedby.specifyother.mandatory = "disabled"

Can anyone offer any suggestions? Or is it even possible to do this?

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

When scripting in dropdowns, I tend to use the exit event.

Because the script is in the object, you will be able to use this.rawValue == "5" in the if statement.

Check that your form is saved as Dynamic XML form in the save as dialog.

Niall

View solution in original post

1 Reply

Avatar

Correct answer by
Level 10

Hi,

When scripting in dropdowns, I tend to use the exit event.

Because the script is in the object, you will be able to use this.rawValue == "5" in the if statement.

Check that your form is saved as Dynamic XML form in the save as dialog.

Niall