cancel
Showing results for 
Search instead for 
Did you mean: 

Using radio buttons with two input fields period and To

former_member198064
Participant
0 Kudos

Hi Experts,

I am having 3 radio buttons with two inputs fields period and To

  • Last Year
  • Current YTD
  • Other              Period        To 

The “Period” and “To” date fields should be disabled until the user marks the “Other” radio button. If the user chooses “Last Year”, then use a BEGDA & ENDDA of 01/01/yyyy & 12/31/yyyy (yyyy is the previous year).  If the user chooses “Current YTD”, then use a BEGDA & ENDDA of 01/01/yyyy & sy-datum (yyyy is current year).  If the user chooses “Other”, then the “Period” and “To” date fields are required; they should be used for BEGDA and ENDDA.

Can you please provide me for this logic how to do.

Thanks,

Venkatesh.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Venkatesh,

Sorry in the previous reply by mistake I noted WDUI_VISIBILITY,its for visibility and invisibility of UI elements.Here we need to enable and disable,so Just create an attribute type WDY_BOOLEAN and bind the attribute to the two input fields Period and To with the property ENABLED.

Initially when the view is processed these two input fields will be disabled.

Then onclick of Other radio button these two input fields needs to be enabled right.

In the Radoibutton UI element there is a property called OnSelect in the events.Create an action and just write the logic provided by MadhuKiran in the action method.

So the logic is onclick or Onselect of the Other Radiobutton,the two UI elements gets enabled.

Try this.........

Regards,

Jyothi

Former Member
0 Kudos

Hi Venkatesh,

Just create an attribute type WDUI_VISIBILITY and bind the attribute to the two input fields Period and To with the property ENABLED.

Initially when the view is processed these two input fields will be disabled.

Then onclick of Other radio button these two input fields needs to be enabled right.

In the Radoibutton UI element there is a property called OnSelect in the events.Create an action and just write the logic provided by MadhuKiran in the action method.

So the logic is onclick or Onselect of the Other Radiobutton,the two UI elements gets enabled.

Try this.........

Regards,

Jyothi

m_aravindan
Active Participant
0 Kudos

Hi Venkatesh,

                    In the init method disable the input fields period and to , by disabling its properties.

ten when user selects the Radio button Other , set the visibility of the 2 input fields enabled.

Regards

Arvnd

Former Member
0 Kudos

Hi Venkatesh,

Create a Attribute in context which is of wdy_boolean type and bind this attribute to both the ENABLED property of input fields after binding by default inputfields will become disabled no need to write in WDDONIT.

Now on the action of radio button write this code.

DATA lo_el_context TYPE REF TO if_wd_context_element.

   DATA ls_context TYPE wd_this->Element_context.

   DATA lv_disable TYPE wd_this->Element_context-disable.

* get element via lead selection

   lo_el_context = wd_context->get_element( ).

* @TODO handle not set lead selection

   IF lo_el_context IS INITIAL.

   ENDIF.

* @TODO fill attribute

* lv_disable = 1.

* set single attribute

   lo_el_context->set_attribute(

     name `DISABLE`

     value = 'X' ).

If you want make visible and invisible of inputfields create a attribute which is of wdui_visibility and bind this to visible property of inputfield and on action method of radio button use the above same code.

Regards

Madhukiran.