cancel
Showing results for 
Search instead for 
Did you mean: 

To change the font color in a webdynpro page

Former Member
0 Kudos

Hi,

My requirement is to change the font color of the input field after an error message is displayed.

I have tried using the setfocus it works but my requiremnt is to change the font color for eg. i entered a invalid date then the cursor should point at that field and the font color should be red.

Thanks,

Nishant

Edited by: nishant patel on Dec 10, 2009 12:57 PM

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

hi ,

in continuattion with the earlier replies..

if u want any other text other thn ur message ,use the context attribute WDUI_TEXT_VIEW_DESIGN , bind this with the Design property of your Textview UI and use set_attribute method using code wizard if u want any text

regards,

amit

Former Member
0 Kudos

Hi,

Does any one have a sample code ?

Former Member
0 Kudos

Use this to throw error message :

*   get message manager
  DATA lo_api_controller     TYPE REF TO if_wd_controller.
  DATA lo_message_manager    TYPE REF TO if_wd_message_manager.

  lo_api_controller ?= wd_this->wd_get_api( ).

  CALL METHOD lo_api_controller->get_message_manager
    RECEIVING
      message_manager = lo_message_manager
      .

*   report message
  CALL METHOD lo_message_manager->report_attribute_error_message
    EXPORTING
      message_text              = 'Error message'
      element                   = lo_el_cn_sflight
      attribute_name            = 'CARRID'
*  
      .

CARRID is my Attribute binded to input field.

lo_el_cn_sflight is my element of Node cn_sflight.

You can use Code wizard (control + F7 ) to have this code.

Former Member
0 Kudos

DATA lo_nd_cn_node TYPE REF TO if_wd_context_node.
    DATA lo_el_cn_node TYPE REF TO if_wd_context_element.
    DATA ls_cn_node TYPE wd_this->element_cn_node .
    DATA lv_attr  LIKE ls_city-ca_attr.
*   navigate from <CONTEXT> to <CN_VISIBLE> via lead selection
    lo_nd_node = wd_context->get_child_node( name = wd_this->wdctx_ca_attr).
 
*   get element via lead selection
    lo_el_cn_node = lo_nd_cn_node->get_element(  ).


 
*  set single attribute
    lo_el_cn_node->set_attribute(
      EXPORTING
        name =  `CA_ATTR`
        value = '03 ' ).
// accordingly  set the value emphasized  , header2 or header3 as u wish 

// press CONTROL +F7 , go to code wizard and select the appropriate context attribute which u want to set

Former Member
0 Kudos

when an error message is thrown then you can get attribute in red as highlighted right...

report_attribute_error.. of if_wd_message_manager...shows this right..

Former Member
0 Kudos

Try to throw error message with report_attribute_error_message and see if it works for you.

It will set focus and mark the input box as red .