cancel
Showing results for 
Search instead for 
Did you mean: 

Highlight a input field when a error occurs

Former Member
0 Kudos

Hi All,

For example, during we create our resumes in monster or naukri, if there is a error in a field, the field colour changes from white to yellow, like that i have a requirement in my webdynpro screen.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

You can use report_attribute_error_message, this will highlight the field with a red border.

Use the following code,

* get message manager
DATA lo_api_controller     TYPE REF TO if_wd_controller.
DATA lo_message_manager    TYPE REF TO if_wd_message_manager.
data: l_node type ref to if_wd_context_node.
data: l_elem type ref to if_wd_context_element.

lo_api_controller ?= wd_this->wd_get_api( ).

CALL METHOD lo_api_controller->get_message_manager
  RECEIVING
    message_manager = lo_message_manager.

l_node = wd_context->get_child_node( 'NODENAME' ).
lr_element = l_node->get_element( ).
* report message
CALL METHOD lo_message_manager->report_attribute_error_message
  EXPORTING
    message_text             = 'Your Text'
    element                      = lr_element
    attribute_name            = 'ATTRIBUTE NAME'.

Regards,

Radhika.

former_member189690
Participant
0 Kudos

Hi all!

I¡m trying to do something similiar but I want to highlight a input field cell of an ALV row table.

I've used the same source code but nothing appears on the screen, no message and no cell highlighted. I put my source code for more information:

LOOP AT lt_data_mod INTO ls_data_mod.

  • alternative access via index

lo_el_n_empleado = lo_nd_n_empleado->get_element( index = ls_data_mod-index ).

  • CHECK VALUE

  • report message

CALL METHOD wd_comp_controller->go_message->report_attribute_t100_message

EXPORTING

msg = ls_msg

element = lo_el_n_empleado

attribute_name = ls_data_mod-attribute.

All that source code is in ON_DATA_CHECK event of ALV component.

Can anyone help me ?

Thanks!

Answers (1)

Answers (1)

former_member230839
Participant
0 Kudos

Hi Siva,

There is no prperty like changing the background color , but what you can do is you anyway binded this input field value to some context node attribute. so if the user enters a wrong value in the input field and press enter . in the ON_ENTER event you can check the wrong value and change the context node attribute value to 'Please enter a correct value' like that .

Regards,

Anil kumar G