Skip to Content
0
Former Member
Mar 05, 2015 at 07:22 AM

How to know which radiobutton is selected in case of dynamic UI generation and how to pass it to back end?

16 Views

This is how I have written for dynamically generating radiobuttons. I have some categories on left view, by selecting which, i will get corresponding questions and it generates 5 options, and user selects one and I need to pass it to back end. I am using IModifiableSimpleValueSet for filling the radiobuttons.

ISimpleTypeModifiable myType = wdThis.wdGetAPI().getContext().getModifiableTypeOf("Ans.option");

IModifiableSimpleValueSet values = myType.getSVServices().getModifiableSimpleValueSet();

.

.

.

..

values.put(d,wdContext.nodeAns().getElementAt(d).getAttributeValue("option").toString());

Kindly help, if I am missing something.

IWDRadioButtonGroupByKey radioKey = (IWDRadioButtonGroupByKey)view.createElement(IWDRadioButtonGroupByKey.class, "ansRadio"+radio_count++);

IWDMatrixHeadData matrixHead_radio = (IWDMatrixHeadData)radioKey.createLayoutData(IWDMatrixHeadData.class);

IWDAction radioAction = wdThis.wdCreateAction(IPrivateRightView.WDActionEventHandler.SELECT_ANS, radioKey.getId());

wdComponentAPI.getMessageManager().reportSuccess("radio id"+radio_count);

radioKey.bindSelectedKey("Ans.option");

radioKey.mappingOfOnSelect().setString("optionID", radioKey.getSelectedKey());

wdContext.currentContextElement().setSel_ans(wdContext.currentAnsElement().getOption());

radioKey.setColCount(1);

questContainer.addChild(radioKey);