Formatting Incorrect Fields

Use

You can highlight incorrect fields in the request form by using the following method:

  • Insert standard style

  • Redefine standard style

  • Insert individual layout

Prerequisites

You have defined a field reference between message and the incorrectly filled field using parameter FIELD.

Example

The following sample source texts come from sample request SAP_DEMO01 view S01_2

Insert standard style

You insert method GET_ERROR_STYLE at the same time as method DISABLED:

<input id="email"<%= application->disabled( '//request/applicant/email' ) %>maxlength="<%= application->get( '//request/applicant/email/@uxx:maxlength' ) %>"name="//request/applicant/email"size="<%= application->get( '//request/applicant/email/@uxx:size' ) %>"type="text"value="<%= application->get( '//request/applicant/email' ) %>"<%= application->get_error_style( '//request/applicant/email' ) %>/>

The method checks whether errors exist and what type of errors they are. If several errors exist, these are issued in the following priority order error (E), warning (W) and information (I). Depending on the error category, the fields contain a red frame for errors, an orange frame for warnings, and a green frame for information.

The following style is included for errors for example:

style="border-style: solid; border-color: #FF0000"

Redefine standard style

If the standard style does not meet your requirements and guidelines, you can replace the standard layout with a colored background. This redefining of the standard style is necessary anyway for fields that do not have a frame that can be formatted (for example, a combo box).

<% application->set_error_style_e('style="background-color:#FF0000"' ). %>

<% application->set_error_style_w('style="background-color:#FF9900"' ). %>

<% application->set_error_style_i('style="background-color:#009900"' ). %>

Individual Layout

If you use a more complicated formatting for the fields, you must assign the corresponding formatting after calling method GET_ERROR_TYPE.

The following sample source text demonstrates the display of error icons:

<% if application->get_error_type( '//request/car/reg_num' ) eq 'E'. %>    <img src="../CRM_WR_DEMO01/ico12_error.gif" width="12" alt="error" /><% endif. %>