How to set the position of cursor on error field in its respective page.



How to turn or highlight a field in RED for error messages issued from SAVEEDIT Event? And to set the position of cursor on error field in its respective page.

When an error message is issued in PeopleSoft (Component Processor) from the SAVEEDIT event, the cursor will not be directed to the corresponding field ( in case of more than on page in a component) for which the message is thrown. And also the field does not turn into red color as is the behavior with the error messages issued from the FIELDEDIT event.

To position the cursor to the required field in a specific page, we use SETCURSORPOS () function. But unlike in the FIELDEDIT event, the field does not get turned into red color when an error message is issued from the SAVEEDIT event. There is a field property which can be used to turn a field into red. The code snippet is as below:

If (conditions) Then
 REM Procedural way of positioning cursor to required record, field and page;
 Recordname.Fieldname.Setcursorpos(Page.Pagename);
 REM Property which turns the field into Red color which is the default behavior of an error message;
 Recordname.Fieldname.Style = "PSERROR";
 REM Any PS Standard way of issuing an error message;
 Error ("The error message to be thrown");
End-If;
 
The above code turns the specified field into Red color and highlights the field in the required target page when an error is issued from a SAVEEDIT instead from FIELDEDIT event.
 
Recordname.Fieldname.Style = "PSERROR"; /* Procedural method of writing this code */
&fieldobject.Style ="PSERROR";                    /* Object oriented method of writing the same code */

No comments:

Post a Comment