Customize Error Messages in your Web Applications
Many developers want flexibility. Appropriately, they deserve it! One way to get flexibility within your m-Power applications is to customize your error messages. While m-Power generates generic terms such as "Invalid User" or "This record already exists" automatically, you can override these messages to something much more appropriate for your web application. For instance, if you are creating a Shopping Cart, you would most likely prefer a message that encourages users to add items to an empty shopping cart in lieu of a "This record does not exist" message.
There are two ways to add customized error messages: on an application level or for the entire Data Dictionary. Simply stated, you should choose the "per application" option if your error message only corresponds to a few applications. For convenience's sake, both methods will be explained:
Per Application Method
If you decide that your Custom Error Message would only apply to a few applications (rather than every application in your Data Dictionary), you should choose this method. Build and compile your application as you normally would. Next, click the "Application Properties" button for your application.
In the m-Painter window, click the "Override Properties" tab:
From the "Override error message" drop-down, select the Default Error Message you wish to customize (in this example, we will customize the "This Record Does Not Exist" message). Click the "Add" button:
Modify the "Value" section to whatever you would like your message to say at Runtime in place of the default message. Here we will program it to say: "No such record — please retry your search."
Click "OK" to save.
When I re-run my application, here is my output when the default "Record does not Exist" message should appear:
Per Data Dictionary Method
If you decide that your custom error messages could apply to all applications within your Data Dictionary, choose this method.
Click the Admin tab, then click the "Edit Data Dictionary Files" link.
Click the "Servlet Properties" link.
Click the "Others" tab to customize messages.
Note: You can also change default images from this tab (such as back & next buttons for Multiple Record/Work-With Templates).
Note: You can also change Maintainer Messages by clicking the "Maintainer Message" tab.
Change the "Value" for the appropriate Error Message name. When completed, hit the "OK" button. Finally, click the "Save and Deploy" icon.
Note: When necessary, changes made at the Application Level supersede changes made at the Data Dictionary Level.