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.

If i have a form with check boxes. Can I add a button that will display the boxes that the user selected on a new page?

Avatar

Level 1

For example, there are 10 check boxes and the user selects 5 of those boxes. Then they click a submit button. Just the information from those boxes would be displayed so they can print it. Is this possible? Any help pointing me in the right direction would be appreciated.

2 Replies

Avatar

Level 7

That is definitely possible.

Option 1: checkboxes are all named differently.

In the click event for the submit button, add some code like this...


if (cbChoice1 == "1") p2.tfChoice1.presence = "visible";


else p2.tfChoice1.presence = "hidden"; //can use "invisible" if preferred


if (cbChoice2 == "1")...


Option 2: checkboxes are named the same

In the click event for the submit button, add code like this...


var checkboxes = xfa.resolveNodes("cbChoice[*]");


var textfields = xfa.resolveNodes("p2.tfChoice[*]");


for (i=0; i<checkboxes.length; i++){


    if( checkboxes.item(i).rawValue == "1") textfields.item(i).presence = "visible";


    else textfields.item(i).presence = "hidden";


}


Avatar

Level 1

All of the checkboxes have different names. That being said will the top code re-display the text that is in the checkbox?

ex: If I had three choices below. The user selects "I think the color used looks fine." he then clicks a submit button and the code runs. Will it display "I think the color used looks fine."? or just the value I assigned that checkbox. (chkBx1)

○ The color red is what I would like to see.

○ I think the color used looks fine.

○ I would like to select my own color to use.