Use the JavaScript Interface to Implement Directory-Level Validation Rules for Attributes
The definition of the JavaScript interface for directory-level validation is as follows:
cim1265
The definition of the JavaScript interface for directory-level validation is as follows:
- Syntaxpublic boolean validate( StringattributeValue, StringRefchangedValue, StringReferrorMessage);
- Parameters
- attributeValueInput parameterSpecifies the value of the attribute being validated.
- changedValueOutput parameterProvides an optional transformation value that replaces the user-supplied value being validated. If no transformation is necessary, pass back null.
- errorMessageOutput parameterIf validation fails, it displays a message to the user.The message is displayed through AttributeValidationException. If the method returns false, generates this exception.
- CommentsThe output parameterschangedValueanderrorMessageare of data type StringRef. StringRef is a predefined data type that contains the fieldreference,to which you assign a value, as shown in the following examples:
- Add a 1 prefix for a properly formatted telephone number:changedValue.reference="+1 " + phoneNumber;
- Provide an error message for an improperly formatted number:errorMessage.reference="Phone number " + phoneNumber + " does not match the format nnn-nnn-nnnn.";
- Returns
- True -- the implementation considers the value inattributeValueto be valid, or it passes back a transformed value inchangedValue.
- False -- the implementation considersattributeValueto be invalid. generates an AttributeValidationException that includeserrorMessage.