on 06-12-2007 1:03 PM
Hi,
I've a radiobutton and a input field. I've a action for the radiobutton. I want change the method for the action. I want that when the radiobutton is selected, the inputfield -> enabled = false. How can i do?
Thanks.
Hi
Create one more attribute in teh context , type WDY_BOOLEAN , and give the default value as false ,which will enable and disable the field on action of the radio button.Bind this new attribute to the enabled field of your UI elemment , here its the input field.
During the action set the attribute value = true.
Thanks
Anzy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
In the context, declare an attribute read_only of type char01.
In the event handler of the radio button,
data: lr_element type ref to if_wd_context_element.
lr_element = wd_context->get_element( ).
lr_element->set_attribute(
exporting
name = 'READ_ONLY'
value = abap_true).
If you want it to be editable when you launch the view, make the default value of read_only as initial. You can make it true on the radio button event. Or vice versa.
Regards,
nithya
Hi
I will provide a step by step approach for you to implement this.
1.Create a node 'MYNODE' in your view context.
Create three attributes in under this node.
a) radiobtn type xfeld.
b) dsply type string.
c) enabled type wdy_boolean ( make default value as ' ' ) so that it will not be enabled.
2. Create UI elements.
In your view create the UI elements.
a) create radio button and bind it with radiobtn from the context.
b) create input field and bind it to dsplay from the context
c) Create an action for the radio button on toggle, let it be onSelect.
d) Bind input field enable property to enabled from the context.
3. Implement the method onSelect.
In the onSelect method , write the following code.
Data: mynode type ref to if_wd_context_node,
myval type xfeld.
mynode = wd_Context->get_Child_Node( `MYNODE` ).
CALL METHOD MYNODE->GET_ATTRIBUTE
EXPORTING
INDEX = USE_LEAD_SELECTION
VALUE = 'myval
NAME = 'radiobtn'
if myval = 'X'.
CALL METHOD MYNODE->SET_ATTRIBUTE
EXPORTING
INDEX = USE_LEAD_SELECTION
VALUE = ' '
NAME = 'enabled'
.
else.
CALL METHOD MYNODE->SET_ATTRIBUTE
EXPORTING
INDEX = USE_LEAD_SELECTION
VALUE = ' X'
NAME = 'enabled'
.
endif.
Please correct the syntax mistake if any, i hope this will solve your problem
Cheers
Anzy
Award points if this solves your problem
Declare a context attribute "read_only" and bind it to the read_only property of your input field. In the event handler of the radio button, set this attribute to X or space. It will automatically reflect in your input field.
Hope this helps.
Regards,
Nithya
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.