Welcome to the SRP Forum! Please refer to the SRP Forum FAQ post if you have any questions regarding how the forum works.

How to add customized error description to a required field?

The default error description for a required field is something like:' XXX is a required entry! A value must be entered...', but I want to add my own error info
How can I modify default error description?

Comments

  • edited December 2018
    This won't help you much @slowjams but that default messaging is one of my pet peevs with databound forms and one of the reasons I avoid using them for anything other than the simplest infrequently used forms. From my experience very little, if any of the OI default messages mean anything of value to the average user.

    I reckon they were probably quite handy in the beginnings of OI when the rev world were converting to Windows and needed to do so as quickly as possible but I think they've long since outlived their usefulness.

    … or maybe I'm just bias because I'm so used to having complete programmatic control over every aspect so I can make windows do what I want and error messages read as they should?

  • There are a couple of ways of approaching this. If you simply want to change the default verbiage, then you can open the OIWIN_REQERR message and save a copy into your local application. Then you can change the wording and this will be the message that gets displayed automatically.

    If you really want to intercept the message and customize the wording on-the-fly, then you will need to intercept the SYSMSG event handler. However, we have discovered that the SYSMSG event for the form does not appear to get called. Therefore, you will have to promoted the SYSMSG event in your local application and add logic to capture the required error message like so:

    $insert PS_EQUATES Ans = 1 If MsgCode EQ SYSMSG_REQUIREERR$ then // The Required Error message is being requested. This means the user is attempting to save the form without // populating all of the required fields. Stop the system event handler from firing, otherwise the default // required field message will display. Ans = 0 // Put custom message logic here. end Return Ans

    This is how our FrameWorks product replaces the message box completely for various system messages and uses our Popup control to display validation errors, required field warnings, and help text:


  • @slowjams did any of this help you?
Sign In or Register to comment.