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
Bedrock Mission!

Learn more

View all

Sign in to view all badges

XML Node Changing Value during Submit Process

Karl_Berlin
Level 2
Level 2

I have a form which utilizes a table with two dropdowns.  You can add or remove rows as needed.  On submit, if you have more than one row, the second row will delete its value from the XML.  It briefly will "change" the value to the one above it, but when looking at the XML, it will show that the value is empty within the node.  It also will push that node to the bottom of the list.  So if I have 3 rows, my XML will show Rows 1,3,2, but 2 will be missing one of its values.

We have two buttons, Remove and Add.  Both use instanceManager.removeInstance(1) or instanceManager.addInstance(1) respectively. 

This GIF showcases what I mean.  When I click Submit, you'll see that just before the form disappears after submission, the value for Row 2: C201 Receiving Room, changes to Lab B.

Glitch.gif

The XML should appear like this:

                    <AdditionalAccess>

                        <BMCLabAccess AccessRequested="">

                            <AccessDetails AccessDescription="">

                                <AccessDetail>

                                    <LabAccess>Lab B</LabAccess>

                                    <LabTimeRequest>24_7</LabTimeRequest>

                                </AccessDetail>

                                <AccessDetail>

                                    <LabAccess>C201 Receiving Room</LabAccess>

                                    <LabTimeRequest>24_7</LabTimeRequest>

                                </AccessDetail>

                                <AccessDetail>

                                    <LabAccess>C301 Custody Room</LabAccess>

                                    <LabTimeRequest>24_7</LabTimeRequest>

                                </AccessDetail>

                            </AccessDetails>

Instead, it looks like this:

                    <AdditionalAccess>

                        <BMCLabAccess AccessRequested="">

                            <AccessDetails AccessDescription="">

                                <AccessDetail>

                                    <LabAccess>Lab B</LabAccess>

                                    <LabTimeRequest>24_7</LabTimeRequest>

                                </AccessDetail>

                                <AccessDetail>

                                    <LabAccess>C301 Custody Room</LabAccess>

                                    <LabTimeRequest>24_7</LabTimeRequest>

                                </AccessDetail>

                                <AccessDetail>

                                    <LabAccess/>

                                    <LabTimeRequest>24_7</LabTimeRequest>

                                </AccessDetail>

                            </AccessDetails>

Not sure what could be causing this.  Had a Daycare ticket going for a month where nobody had an answer and it has been closed.

4 Replies
DarrenBiz
Level 7
Level 7

Hard to say without looking at the code. If you can supply a cut-down version of the form with just this section in it, we could take a look and see if the same thing happens locally. Also need to know what version of AEM Forms you are rending the HTML5 forms in.

It seems strange that in the data, the <LabAccess> value for the 3rd row is now populated into the field in the 2nd row and the 3rd row <LabAccess>  value is empty. The data doesn't mirror what is happening on the screen, so something else must be happening on submit.

Mayank_Gandhi
Community Advisor
Community Advisor

Agreed to Darren's suggestion, we would need a sample form to check the issue.

What is the behavior in case you render it as a pdf?

-Mayank

Karl_Berlin
Level 2
Level 2

Have not rendered it as a PDF, unsure how I would do that and be able to submit/check the XML.

Is there a way I can attach an LCA here to this post?  It does seem strange that rather than cutting out the second row data it's "pushed" down.

Mayank_Gandhi
Community Advisor
Community Advisor

Upload it on some shared drive and paste the link here.