Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

AEM Forms 6.3 DropDown List appends items on new assignment

Avatar

Avatar
Validate 1
Level 2
Maruan_Sahyoun
Level 2

Likes

3 likes

Total Posts

31 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 3
Boost 1
View profile

Avatar
Validate 1
Level 2
Maruan_Sahyoun
Level 2

Likes

3 likes

Total Posts

31 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 3
Boost 1
View profile
Maruan_Sahyoun
Level 2

07-02-2018

I'm running AEM Forms 6.3 and experience an issue when dynamically populating a dropdown.

On initialize of a certain field I add an array of items to the dropdown using DropDown.items = array. Now when the filed changes I'd like to replace the items with another set of items. That doesn't work. The new items are appended so the drop down list get's longer. What's strange is that the newly created set of items can be changed but the original assignment is always kept.

Further more printing DropDown.items to the console the correct items show up.

To further illustrate that

# initial assignment - 5 items - DropDown list contains 5 items visually - DropDown.items.length = 5

# new assignment - 3 items - DropDown list contains 8 items visually - DropDown.items.length = 3

Verified in Chrome and Firefox.

We are running AEM Forms JEE - SP1 - available patches are installed.

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Validate 25
Level 5
James_R_Green
Level 5

Likes

47 likes

Total Posts

191 posts

Correct Reply

47 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Boost 5
Boost 3
View profile

Avatar
Validate 25
Level 5
James_R_Green
Level 5

Likes

47 likes

Total Posts

191 posts

Correct Reply

47 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Boost 5
Boost 3
View profile
James_R_Green
Level 5

12-02-2018

I can reproduce this when a dropdown list is bound.

The error doesn't occur when the dropdown is unbound.

Tested this on 6.2 and it doesn't append the values (which is what I would expect), to me the functionality has changed between 6.2 and 6.3 and I don't know why you would want it to work the way it appears to work in 6.3 so I personally think this is a bug.

A few options:

* if two dropdowns (dropdownA and dropdownB) are bound to the same field, and you set dropdownB.items = ["A=A","B=B","C=C"]; - dropdownB exhibits the appending you have reported *but* dropdownA does not. You could use this to your advantage and hide dropdownB - not pretty, but if you are desperate for a workaround it might help. It will also depend how many dropdowns you have on your form whether this is a viable option.

* Or similarly use an unbound field on the form and copy the value to a bound copy of the field on submit.

* Otherwise, try creating a custom widget for dropdownlist and see if that has the same issue.

Answers (8)

Answers (8)

Avatar

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,406 likes

Total Posts

12,671 posts

Correct Reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,406 likes

Total Posts

12,671 posts

Correct Reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile
smacdonald2008
Level 10

12-02-2018

Glad james was helpful. This is the point of the AEM community. To try and help as much as possible.

Avatar

Avatar
Validate 1
Level 2
Maruan_Sahyoun
Level 2

Likes

3 likes

Total Posts

31 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 3
Boost 1
View profile

Avatar
Validate 1
Level 2
Maruan_Sahyoun
Level 2

Likes

3 likes

Total Posts

31 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 3
Boost 1
View profile
Maruan_Sahyoun
Level 2

12-02-2018

Hi James,

thanks for taking the effort and also providing a workaround solution. What we ended up with is to remove the binding on the field and pass the selected information in another field.

Moving forward we'll go with schema binding anyway.

Many thanks also to Scott and Jagjeet for looking into that.

With kind regards

Maruan

Avatar

Avatar
Validate 1
Level 2
Maruan_Sahyoun
Level 2

Likes

3 likes

Total Posts

31 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 3
Boost 1
View profile

Avatar
Validate 1
Level 2
Maruan_Sahyoun
Level 2

Likes

3 likes

Total Posts

31 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 3
Boost 1
View profile
Maruan_Sahyoun
Level 2

07-02-2018

So what you are saying is that the scripting should go to the XFA Template?

Btw. it did work in AEM Forms 6.2.

Avatar

Avatar
Boost 5
Level 2
jagjeetthukral
Level 2

Likes

7 likes

Total Posts

36 posts

Correct Reply

4 solutions
Top badges earned
Boost 5
Boost 3
Boost 1
Applaud 5
Affirm 3
View profile

Avatar
Boost 5
Level 2
jagjeetthukral
Level 2

Likes

7 likes

Total Posts

36 posts

Correct Reply

4 solutions
Top badges earned
Boost 5
Boost 3
Boost 1
Applaud 5
Affirm 3
View profile
jagjeetthukral
Level 2

07-02-2018

I don't think this is a bug.

There is a point we are missing here, since that field is mapped to an XFA element, it is supposed to have values that only XFA dropdown is mapped to.

The right approach to handle your scenario should be to have the dropdown dynamic in XFA itself. The process remain almost similar to what you are doing in Adaptive Forms

Hope this helps !!!

Cheers,

Jagjeet Singh

AEM Forms Blog

Avatar

Avatar
Validate 1
Level 2
Maruan_Sahyoun
Level 2

Likes

3 likes

Total Posts

31 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 3
Boost 1
View profile

Avatar
Validate 1
Level 2
Maruan_Sahyoun
Level 2

Likes

3 likes

Total Posts

31 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 3
Boost 1
View profile
Maruan_Sahyoun
Level 2

07-02-2018

Btw. this is a very simple Options Expression I used for testing. Other events show the same behaviour.

if (Anwendungsfall.value == 1) {

  this.items = ["A=A", "B=B", "C=C", "D=D", "E=E"];

} else {

  this.items = ["A=A", "B=B", "C=C", "D=D", "E=E"]; 

}

Avatar

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,406 likes

Total Posts

12,671 posts

Correct Reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,406 likes

Total Posts

12,671 posts

Correct Reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile
smacdonald2008
Level 10

07-02-2018

That is interesting. Question is if there is a bug or is there something that is missed when setting up the XFA model. I have asked the AEM Form team to look here.

Avatar

Avatar
Validate 1
Level 2
Maruan_Sahyoun
Level 2

Likes

3 likes

Total Posts

31 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 3
Boost 1
View profile

Avatar
Validate 1
Level 2
Maruan_Sahyoun
Level 2

Likes

3 likes

Total Posts

31 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 3
Boost 1
View profile
Maruan_Sahyoun
Level 2

07-02-2018

This happens only for an XFA template based adaptive form. The DropDown list is bound to the XFA based data model. Creating an adaptive form from scratch doesn't show that behavior.

Avatar

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,406 likes

Total Posts

12,671 posts

Correct Reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,406 likes

Total Posts

12,671 posts

Correct Reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile
smacdonald2008
Level 10

07-02-2018

Are you following an online doc for this - can you point the community to that to see if that can be reproduced.