Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

Need drop down choice from one table to be added to a new table with a click of a button.

Avatar

Level 6

Good day,

I am following up on my previous question with the same subject because I'm not sure if my reply to MHWinter is being forwarded.  Please excuse me if I'm doing this all wrong and advise me what I should have done or what I need to do....MHWinter was very helpful with solving my issues with the above subject but I came across another issue.  Hopefully, MHWinter can solve this one or maybe someone else can....

Some of my "cards" have an "invisible" drop down field that appears when the user clicks a button because the field is not always a requirement.  The problem is that when they add another "card", the drop down field selection is not copied to the next "card" when they click the "similar" button.  It reverts to it's original presence.  I need for that selection to be copied to the next card.  Can you help me with that?  

1 Accepted Solution

Avatar

Correct answer by
Level 5

Currently in your form, the checkbox shows or hides the Type dropdown field of the 1st instance of the table only. I see at least 3 options depending on what you are trying to achieve, which is still not clear to me:

- the single check box shows or hides all instances of the type dropdown field, i.e. for each instance of the table --> use resolveNodes;

- each CARD (i.e. table) includes its own checkbox to show/hide the type field in that table --> this.parent.parent.parent.Row1.type.presence... (assuming the checkbox would be in the same subform as the buttons)

- you can script the Create Similar button to detect the presence status of the type dropdown field  of the CARD to duplicate and make it the same in the new CARD --> .add something like this to the script of the button 

if (this.parent.parent.parent.Row1.type.presence == "visible"){
this.resolveNode(sTargetNew).Row1.type.presence = "visible";
} else {
this.resolveNode(sTargetNew).Row1.type.presence = "invisible";
}

 

View solution in original post

5 Replies

Avatar

Level 5

Can you share your form again, and clarify further the expected behavior?

Avatar

Level 5

Regardless of the visibility of the dropdown field, the its value can be copied from the "Card" being duplicated. 

You can then set the visibility of the field depending on the value of that field or another field, or on the visibility status of the field in the card being duplicated,... or without condition. 

Avatar

Level 10

To have all instances of that dropdown with the same value, just set the binding to global and make sure each is named the same way. 

 

For the presence you would have to use additional scriptings to check the presence of a referenced dropdown and copy to all other instances of it. Can you provide a sample of your for or at least a screenshot showing the forms hierarchy?

Avatar

Level 6

radzmar and MHWinter,

 https://drive.google.com/file/d/1G2FxXhPU_pp_2Ii5e8maLroi1NABMBzO/view?usp=sharing 

 

If you click on the Checkbox1 in the master page, "Type" is made visible in the "table".  Then you would choose from the dropdown menu.  When you click "Create Similar Table" button, the information in "Type" is not copied to the new table.

Thank you for your help!

Avatar

Correct answer by
Level 5

Currently in your form, the checkbox shows or hides the Type dropdown field of the 1st instance of the table only. I see at least 3 options depending on what you are trying to achieve, which is still not clear to me:

- the single check box shows or hides all instances of the type dropdown field, i.e. for each instance of the table --> use resolveNodes;

- each CARD (i.e. table) includes its own checkbox to show/hide the type field in that table --> this.parent.parent.parent.Row1.type.presence... (assuming the checkbox would be in the same subform as the buttons)

- you can script the Create Similar button to detect the presence status of the type dropdown field  of the CARD to duplicate and make it the same in the new CARD --> .add something like this to the script of the button 

if (this.parent.parent.parent.Row1.type.presence == "visible"){
this.resolveNode(sTargetNew).Row1.type.presence = "visible";
} else {
this.resolveNode(sTargetNew).Row1.type.presence = "invisible";
}