Expand my Community achievements bar.

July 31st AEM Gems Webinar: Elevate your AEM development to master the integration of private GitHub repositories within AEM Cloud Manager.

duplicating radio buttons

Avatar

Former Community Member
This is my first time creating a Designer form from scratch. I'm creating a form with multiple questions having y/n answers. I created the first set of y/n radio buttons, sizing them the way I wanted. Rather than having to size each set, I want to duplicating them for each question. But when I do, it lumps them together with the ones above as one set of radio buttons, allowing only one to be checked. How do I get it do make them a seperate set, not part of a group.



Deb
5 Replies

Avatar

Former Community Member
OK, this is so frustrating to me. If I do this over and over and over, some times I get them to work the way I want, sometimes not. I have no idea why. Why is this so difficult? In any other software, you do a cut and paste or a duplicate and get another copy you can put someplace else. What is going on here????



Deb

Ready to throw my mouse across the office

Avatar

Former Community Member
Sorry about the ranting. I finally was able to add 5 sets of y/n buttons, tho that still does not explain why it didn't work before.



Now I'm trying to add a third radio button after the yes and no, for n/a (which was an afterthought). And of course I'm getting the same thing, where it wants to link them to others above or below. Can someone explain how you add these buttons, or how you stop them from grouping with the wrong set???



Deb

Avatar

Former Community Member
If you drop a pair of radio buttons on a form they should by default by made part of the same radio button list. If you wanted to create a series of these list (grouped radio buttons - for example, a "Yes" and "No" series for a list of questions on a form), you should use the Copy Multiple function (select the radio button list and select Edit - Copy Multiple). Doing this should give you a series of radio button lists in your object hierarchy palette (i.e., RadioButtonList[0], RadioButtonList[1], RadioButtonList[2]). You would then want to rename these to something more descriptive.



Adding a "N/A" option to one of these lists should be a simple matter of moving the object under whatever radio button list you want to add it to.



For example, in the Hierarch view:

Question1

Yes

No

Question2

Yes

No

NA

Question1

Yes



where Question1, Question2, etc. are my radio button lists and Yes, No are my radio button objects.



No

Avatar

Former Community Member
Deb,



To expand further - the property that nominates which radio buttons belong to the same group is the name property of the buttons - all rds that have same name property are mutually exclusive. In addition to this, you will want to associate a different value to each option.



E.G. Yes - value =Y No Value =N N/A value = 0 or something to that effect. The radio button name will then be used as the node name for the XML created, and only the value identified for the selected radio button will be included in the XML output.



Hope this clarifies the issue a little.



Sanna

Avatar

Former Community Member
In order to save time when needing this particular "Yes/No" control in the future, a shortcut would be to create your own custom control.



To create a custom "Yes/No radio button control":



1. Drop a Text object on the canvas. Make it a size that works for your type of question. (The text control will grow when you type in it, which may require resizing eventually, so to save those mouse drags, try to make it a size that will fit questions most of the time.) On the hierarchy viewer, you can rename this text object "Question".



2. Drop 2 Radio Buttons under the Text object. Place them in a manner/location than is aesthetically appealing to you. Change the caption of the first radio button to "Yes" and of the second one to "No".



3. Select the three objects (text & 2 radio buttons.) Right click on the selection to bring up the context menu and choose "Wrap in Subform". You can rename this subform "YesNoControl" in the hierarchy viewer if you like.



4. Select the "grouped" object on the canvas. Now that it is grouped in a subform, you can select the entire object as one. Right-click to bring up the context menu and choose "Add to Library..." Pick a name (i.e. "Yes/No Control") and a group to put it in.



Your new object will appear in the Object Library. Now you can drag a full Yes/No Control onto the canvas at any time. You no longer need to copy/copy multiple to use this control.



If you want to add another radio button sometimes, just drop a radio button on the form and add it to the RadioButtonList (i.e. by dragging it into the group in the Hierarchy viewer). You may have to change its value to to make sure it is added correctly.



Hope this little trick helps ease the frustration a little bit.



Stephanie Legault

Software Developer

Adobe Systems