Language Reference Guide : 4. System Classes : ActiveField Class : CheckFailedMandatory Method
 
Share this page                  
CheckFailedMandatory Method
The CheckFailedMandatory method checks that a mandatory field has an entered value. It also checks all children if the field is a composite field.
This method has the following syntax:
Field = ActiveField.CheckFailedMandatory
          (setfocusonfailure = smallint)
If this method locates a mandatory field that has no values, it issues an error and returns the field that failed. Otherwise null is returned. If SetFocusOnFailure is TRUE (the default setting), the input focus is set to the field that failed the check. If SetFocusOnFailure is FALSE, the focus is not set to the invalid field.
The following example uses the CheckFailedMandatory method to check all the child fields in a composite field empfield:
/* Be sure user has filled in all required
** fields. If not, set input focus to the first
** field with missing data.
*/
if empfield.CheckFailedMandatory
(SetFocusOnFailure = TRUE) is null
then
/* Invoke Hire method to do the work. */
...
Note:  Fields containing default values (for example, zero for numeric fields) are considered to contain a value. Therefore, if any field being checked with the CheckFailedMandatory method contained a default value that you wanted the user to change, you would need to write additional code.