cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamically enable disable OK button in pop up window

former_member184111
Active Contributor
0 Kudos

Hello Experts,

We have a requierment to display a pop up window with some text(terms and conditions of use) with a check box (I Accept).

How can I enable disable the OK button in pop up window based on the check box.

If the cbox is checked--> enable the OK button else disable it.

I searched the forum and found the thread

[Making the button disabled in the pop up window|]

but could not understand the complete steps.

Can some one please explain how to achieve this ?

Thanks,

Anubhav

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

>

> Hello Experts,

>

> We have a requierment to display a pop up window with some text(terms and conditions of use) with a check box (I Accept).

> How can I enable disable the OK button in pop up window based on the check box.

> If the cbox is checked--> enable the OK button else disable it.

>

> I searched the forum and found the thread

> [Making the button disabled in the pop up window|]

>

> but could not understand the complete steps.

>

> Can some one please explain how to achieve this ?

>

> Thanks,

> Anubhav

It is simple if its your custom popup window.

You have a context attribute of type wdy_boolean binded to checked property of the checkbox.

Bind the same attribute for the OK button enabled property.

former_member184111
Active Contributor
0 Kudos

Hi Baskaran,

I am using below code

DATA lo_window_manager TYPE REF TO if_wd_window_manager.
  DATA lo_api_component  TYPE REF TO if_wd_component.
  DATA lo_window         TYPE REF TO if_wd_window.

  lo_api_component  = wd_comp_controller->wd_get_api( ).
  lo_window_manager = lo_api_component->get_window_manager( ).
  lo_window         = lo_window_manager->create_window(
                     window_name            = 'W_POPUP'
                     title                  = 'Terms And Conditions'
*                    close_in_any_case      = abap_true
                     message_display_mode   = if_wd_window=>co_msg_display_mode_selected
                     close_button           = abap_false
*                     button_kind            = if_wd_window=>co_buttons_ok
                     message_type           = if_wd_window=>co_msg_type_none
                     default_button         = if_wd_window=>co_button_ok
                     ).

  lo_window->open( ).

To open the pop up window in method WDDOINIT of my MAIN view to show the pop up before the main application is displayed.

How to bind the ENABLED property of OK button in this case ?

Thanks,

Anubhav

Former Member
0 Kudos

enable this line in your code.

button_kind = if_wd_window=>co_buttons_ok

in the component controller save the lo_window instance as public attribute so that you can access this later from the popup view.

in the popup view, wddomodifyview method check if the checkbox is checked based on that call the set_button_enabled method.

if first_time = abap_true.

wd_comp_controller->lo_window->set_button_enabled( abap_false ).

endif.

Edited by: Baskaran Senthivel on Mar 31, 2011 2:07 PM

Former Member
0 Kudos

Hi,

Create button in view, create action as OK.

Create one attribute on type wdy_boolean, bind to button enable property.

In OK button On_action write code..

Read checkbox value here.. if it is checked for example..

if lv_check = 'X'.

  • get single attribute

lo_el_context->set_attribute(

EXPORTING

name = `ENABLE`

value = abap_true ).

else.

  • get single attribute

lo_el_context->set_attribute(

EXPORTING

name = `ENABLE`

value = abap_false ).

endif.

Cheers,

Kris.

Answers (0)