How to get selected radio button value from Dialog to JS? | Community
Skip to main content
October 16, 2015
Solved

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

  • October 16, 2015
  • 3 replies
  • 2168 views

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

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Scott_Brodersen

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

3 replies

Scott_Brodersen
Level 8
October 16, 2015

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

October 16, 2015

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

Scott_Brodersen
Scott_BrodersenAccepted solution
Level 8
October 16, 2015

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