How to turn or highlight a field in RED for error messages issued from SAVEEDIT Event?
When an error message is issued in PeopleSoft(Component Processor) from the SAVEEDIT event, the cursor will not be directed to the corresponding field (value) for which the message is thrown. And the field also doesnot turn into red color as is the behaviour 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);
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 */
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);
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 */
Thank you for your post! It helped. Here is piece of code...
ReplyDeleteIf None(record name.ALS_BANK_ACCT_TYPE) Then
SetCursorPos(Page.pagename, recordname.fieldname, CurrentRowNumber());
recordname.fieldname.Style = "PSERROR";
Error MsgGet(31000, 23, "Please pick a Bank Account Type");
End-If;
Thanx for the post.
ReplyDeleteThank you for the post. This helped me in resolving a long standing issue in tools upgrade.
ReplyDeleteThanks a lot for the post. It helped me too.
ReplyDeleteThanks for post, it was helpful.
ReplyDeleteI found that field remains red even after correcting the error and hence had to add the below else part.
Else
Recordname.Fieldname.Style = "PSEDITBOX";
End-if;
Hi,
ReplyDeleteWe have a requirement to display the all the mandatory fields at one shot when the values are not entered in those fields. Could you please let me know how to acheive this.
Hi,
ReplyDeleteNormally in peoplesoft when values are not entered for required fields, error message will be displayed sequentially. We have a requirement to display all the mandatory fields in the error message at one shot when the values are not entered in those fields. Could you please let me know how to acheive this.
Hi Even i tried putting the values in savedit still im getting the error sequentiallly but not at one shot any help is appreciated!!!
Deleteyou will not get all fields getting error at one go. its always one at a time and sequential.
DeleteI would suggest to have validations in savedit so that all validations will fire at once. Thats the best option than doin at fieldedit of a particukar field and end up highlighting all other fields.
ReplyDeletereally helps! :)
ReplyDeleteCan i make it red even on a grayed out field?
ReplyDeleteThnakyou SHyam, for the wonderful piece of code
ReplyDelete