on 01-26-2010 7:40 AM
Hi All,
I have created a view with 2 radio buttons and 2 input fields in it:
RadioBtn_1
RadioBtn_2
InputField_1
InputField_2
What I need to do is:
- If the user selects RadioBtn_1, I want to enable InputField_1 and disable InputField_2.
- If the user selects RadioBtn_2, I want to enable InputField_2 and disable InputField_1.
I have created an onSelect action ONACTIONTOGGLE_RADIOBTNS that runs when either of the radio buttons are clicked.
My code goes something like this:
METHOD onactiontoggle_radiobtns .
lr_inputfield TYPE REF TO cl_wd_input_field.
...
...
lr_inputfield ?= view->get_element( 'INPUT_FIELD_1' ).
lr_inputfield->set_visible( cl_wd_uielement=>e_visible-none ).
endmethod.
However I get an error saying that "Field 'View' is unknown.
What is wrong? I tried to search for examples in this forum, and it seems that everyone uses this statement. I know I probably didn't declare something somewhere... Can anyone help me out? Thanks in advance!
Hi Thomas, thank you for the prompt response! I was hoping that I need not bind the element to a node...
So in this case, I would gather that this is the recommended practice. Is this written anywhere in the SAP Library or SDN Blogs? It would be great if there was a reference somewhere that documented all the best practices when coding with Web Dynpro ABAP!
Thanks once again!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You should not access the UI elements directly. Instead data bind the UI elements enabled or visible properties to a context attribute. On the event tied to your radiobutton, only change the value in the context that these properties are bound to. This will cause the UI to properly redraw. This way you can change the name of the UI elements, expand or contract the number of UI elements, etc and never have to touch your coding.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
80 | |
9 | |
9 | |
7 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.