Wednesday, January 15, 2014

Changing Default Item Required Error Message in APEX

In APEX, if a page item is a required value it is no longer necessary to create an explicit validation. Setting the item's option "Value Required" to Yes will make it a required field as shown below.


This is much quicker then manually creating Not Null validations for each required item as required in older versions of APEX.

If the page is submitted and the item is null, then the page will be reloaded with a validation error message stating that "" The default message can me changed by doing the following:

  • Go to Shared Components > Text Messages (under Globalization)
  • Create Text Message
    • Name: APEX.PAGE_ITEM_IS_REQUIRED
    • Text: #LABEL# can not be null
      • Use what ever message you'd like to see.
      • Note that the substitution string #LABEL# is used for the item's label.
When the page is now submitted and the item is null, the page will be reloaded with a validation error message stating that "". 

The above technique changes the default message for all items that have their Value Required option set to Yes (i.e. it's an application level setting).

3 comments: