cancel
Showing results for 
Search instead for 
Did you mean: 

Radio Button Problem

Former Member
0 Kudos

Hello all,

Am new to WebDynpro. I have a requirement like this.

Radio Button1 - Input Field 1

Radio Button 2 - Input Field 2

When i select Radio 1 Input Field 1 Should be enabled and vice versa. At wdDoInit Radio Button 1 and Input Field 1 shoudl be enabled by default.

For this, i have created 5 context attributes

1) Va_RadioSelect (String) mapped to SelecetedKey of RadioButton1 and RadioButton2

2) Va_KeytoSelect1 (boolean) mapped to KeytoSelect of RaiodButton1

3) Va_KeytoSelect2 (boolean) mapped to KeytoSelect of RaiodButton2

4) Va_InputEnabled1 (boolean) mapped to Enabled of Input Field1

5) Va_InputEnabled2 (boolean) mapped to Enabled of Input Field2

Code

wdDoInit

va_keyToSelect1 (true)

va_keyToSelect2 (false)

va_InputFieldEnabled1 (true)

va_InputFieldEnabled2 (false)

onActionRadioButton1Selected

va_keyToSelect1 (true)

va_keyToSelect2 (false)

va_InputFieldEnabled1 (true)

va_InputFieldEnabled2 (false)

onActionRadioButton2Selected

va_keyToSelect1 (false)

va_keyToSelect2 (true)

va_InputFieldEnabled1 (false)

va_InputFieldEnabled2 (true)

Is this the right approach or is there a different simpler approach?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Yogesh,

I'd instead, create a SimpleType in the Local Dictionary, as a Enumeration:

Value: 1, No Description

Value: 2, No Description

You can use a RadioButtonGroupByKey, event onClick would do somethig like


String selectedValue = wdContext.currentXXElement.getRadioValue(); // Context Value, Radio Button;
if ("1".equals(selectedValue))
// Enable First Text, Disable Second..
else
// Enable Second, Disable First..

You will need two other Context Values to hold the boolean for TextFields.

Regards,

Daniel

Edited by: Daniel Ruiz on May 20, 2009 8:36 AM

Answers (3)

Answers (3)

Former Member
0 Kudos

Thnks everybody.

gill367
Active Contributor
0 Kudos

Hello Yogesh,

Have a look at this thread, we can use radiobuttongroupByKey also for this.

[RadioButtonGroupByKey |]

Sarbjeet Singh

Former Member
0 Kudos

HI

the approach you have followed is providing the result you need , then you can go ahead with

what you have done , and its a right approach you have followed .