Skip to Content
avatar image
Former Member

Radio Button Problem

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?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Best Answer
    avatar image
    Former Member
    May 20, 2009 at 06:35 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 20, 2009 at 07:04 AM

    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 .

    Add comment
    10|10000 characters needed characters exceeded

  • May 20, 2009 at 07:33 AM

    Hello Yogesh,

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

    [RadioButtonGroupByKey |how-to-give-inputfields-for-radiobuttons]

    Sarbjeet Singh

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 26, 2009 at 12:40 PM

    Thnks everybody.

    Add comment
    10|10000 characters needed characters exceeded