NetIQ IDM - How to validate form field based on the Regular Expression (validation mask) in NetIQ Userapp workflow forms
Workflow forms in the NetIQ Userapp provides to validate input fields using regular expression.
Here is the recipe:
Example allow only alphabets and spaces in the form field.
1. On the form field, Add regular expression validation mask:
^[a-zA-Z ]*$
2. On the form field, Add event (OnChange)
3. Add following code on the Event handler:
/*
Function to validate with mask (default) and set new
message if not valid returns true if field valid, else false
*/
function validateField() {
// check if field is valid, by calling default validation,
//which uses the mask
if (field.validate()) {
// not valid
form.clearMessages(); // get rid of the default
// validation mask message
form.showError("The entry " + field.getValue() + " is " +
"not valid");
return false; // field not valid
} else {
// valid, clear old messages
form.clearMessages();
return true; // field is valid
}
};
if (field.getValue() != ""){
validateField();
}
Comments