on 08-25-2014 6:53 AM
Hi Experts ,
I have ten input fields on view,all are mandatory fields my requirement is after clicking on submit button if any of the input field is not entered
then cursor/Focus should be on that input field ,can anybody tell me the solution advance thanks.
Regards
Sandesh
Hi,
Are you displaying any error messages if the field is initial? If so, you cannot set focus on field as the focus will be shifted to message area. you can use report_attribute_error_message( ) method of message manger to highlight the input field(in red color, but no focus set).
If you want to set the focus without any error messages, use the below code
DATA: lr_elem TYPE REF TO if_wd_view_element.
lr_view type ref to if_wd_view.
lr_view ?= wd_this->wd_get_api( ).
lr_elem = view->get_element( 'INP1' )." INP1 is the UI element ID of input field1
lr_view->request_focus_on_view_elem( lr_elem ).
hope this helps,
Regards,
Kiran
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Kiran ,
Thanks for quick response , yes if the field is initial i am displaying the error message . For
this method report_attribute_error_message( ) can you please tell me what should be passed in exporting parameters Element and attribute name . My requirement is to highlight the input field if the Input field is initial along with the error message .Advance Thanks
Regards
Sandesh
Hi,
Use the below code:
DATA lo_message_manager TYPE REF TO if_wd_message_manager.
* Get Message manager
lo_api_controller ?= wd_this->wd_get_api( ).
CALL METHOD lo_api_controller->get_message_manager
RECEIVING
message_manager = lo_message_manager.
* Get the context element
DATA lo_nd_node TYPE REF TO if_wd_context_node.
DATA lo_el_elem TYPE REF TO if_wd_context_element.
lo_nd_node = wd_context->get_child_node( name = wd_this->wdctx_node ). " node is name of your Context node
lo_el_elem = lo_nd_node->get_element( ).
CALL METHOD lo_message_manager->report_attribute_error_message
EXPORTING
message_text = 'Error Message'
element = lo_el_elem
attribute_name = 'ATTR'. " ATTR is the attribute name to which the input field is bound
hope this helps,
Regards,
Kiran
Hi Sandesh,
In case if you are validating all the mandatory fields at the end,(at submit), its better to use cl_wd_dynamic_tool class for checking all the fields and get the error message.
Regards,
Harsha
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
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.