cancel
Showing results for 
Search instead for 
Did you mean: 

Working with radio Button

Former Member
0 Kudos

Hi all,

I'm having two radio buttons and i have mapped the selected key property of both the radio buttons to the same attribute and the key to select property to the different attributes.

Now when i load the page its showing both the buttons unchecked, i need anyone of the two buttons should be checked when defaultly open the page.

Regards,

Suresh.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Suresh,

Your can use the following scenario to solve the problem.

You can have a RadioButtonGroupByKey UI Element and change its colCount property to 2. Suppose you want to give a Yes/ No option to the user. Then create a simple type, in enumeration tab add two values as Y & Yes and N & No for Value and Description respectively. Then create a value node make its cardinality as 1:1. Inside that make a value attribute of the simple type which you just created.

Finally map the selectedKey property of your RadioButtonGroupByKey to this attribute.

Then in wdDoInit method you can set the property as follows:

wdContext.nodeOptionYesNo.currentNodeOptionYesNo.setOption("Y");

where,

OptionYesNo is the name of the value node and Option is the name of your value attribute.

Hope this will solve your problem.

thanks & regards,

Manoj.

Former Member
0 Kudos

Hi Suresh,

Assume you have binded the keyToSelect property of RB1 and RB2 to KS1 and KS2 respectively and the value of KS1=Key_1 and KS2=Key_2.

Assume the context attribute binded to both the radio buttons is SelectedKey

Now, if you want RB1 to be selected by default when the page loads then set the SelectedKey value.

WDDoInit()

{

.

.

wdContext.currentContextElement.setKS1("Key_1");

wdContext.currentContextElement.setKS2("Key_2");

// first radio button selected by default

wdContext.currentContextElement.setSelectedKey(wdContext.currentContextElement.getKS1);

//or second button selected by default

wdContext.currentContextElement.setSelectedKey(wdContext.currentContextElement.getKS2;

}

Regards,

Murtuza