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.
SOLVED

How to get selected radio button value from Dialog to JS?

Avatar

Former Community Member

Hi,

 

I designed two radio buttons in a tab (dialog).

When i selected that radio button i able to call the method  which i wrote in external JS through listeners .

But i want to get the selected radio button value from that panel exists in dialog?

Based on this selection i need to hide multiple tabs or panel at a time in a tab panel and shows one panel which is selected in radio buttons.

Hope my question clear.

Thanks in advance

1 Accepted Solution

Avatar

Correct answer by
Level 8
3 Replies

Avatar

Level 8

I like the dialog.findbytype function. This example returns the numberfield objects on a dialog, but you can use the radio type instead:

var fields = dialog.findByType("numberfield");

see:

http://dev.day.com/docs/en/cq/current/widgets-api/output/CQ.Dialog.html

 

scott

Avatar

Former Community Member

This is what i coded

manageTabs  = {};
manageTabs = function(dialog) {

     // console.log(dialog.find("title", "SwitchTabs")[0].find('myid')));
      var fields = dialog.findByType("selection");
      console.log(fields);
};

I can see the "selection" object which contains three options how to get that selected option from those three?

Thanks

Avatar

Correct answer by
Level 8

selection.getValue() would seem to be the method to use:

http://dev.day.com/docs/en/cq/current/widgets-api/output/CQ.form.Selection.html

 

scott