Previous Topic: Configure a Dynamic Organization FieldNext Topic: Configure Dynamic Field Display Properties


How to Change Field Display Properties Dynamically

CA Identity Manager can set certain field display properties based on the value of other fields in a profile screen. Using JavaScript, you can hide and show a field, or enable and disable a field. For example, you can use JavaScript to show an Agency field if the Employee Type is set to Temp. If the Employee Type is Full Time or Part Time, the Agency field is hidden.

You enter the JavaScript in the Initialization JavaScript or Validation JavaScript fields in the Field Properties dialog in the profile screen definition. The methods that control the display of a field are available in the FieldContext class of the init and validate methods.

For example, to control the display of the Agency field described above, you would enter the following JavaScript code in the Validation JavaScript field in the Field Properties for the Employee Type field, since the changes to the Employee Type field control the display of the Agency field:

function validate(FieldContext, attributeValue, changedValue, errorMessage) {
if (attributeValue == "Temp") {
FieldContext.showField("Agency");
  }
else {
FieldContext.hideField("Agency");
}
return true;
}

To ensure that the JavaScript is triggered when the field value changes, set the Validate on Change field to Yes.