How to show/hide an attribute from the screen dynamically?
search cancel

How to show/hide an attribute from the screen dynamically?

book

Article ID: 377934

calendar_today

Updated On:

Products

CA Identity Suite CA Identity Manager

Issue/Introduction

If you have a screen where you need to show/hide a specific attribute depending of another attribute, see the steps below

This article refers to attribute which is Read-Only, if the attribute you need to check is Read/Write, please see Additional Information.

Environment

Identity Manager 14.x

Resolution

Below is the screen and the fields we will work on this article

- Title is a Read-Only attribute, and depends on its value we will show/hide the field "One Selection"

 

- From menu Modify Admin Task that you need to show/hide the attribute

- Select Tabs > Profile > Browse button from Screen field and Edit button

- Edit the Read-Only attribute, in this example, it's the Title attribute

- Copy the JavaScript code below in the "Initialization JavaScript" field, if the Title == "Temp" the attribute "String 000" will be hide otherwise show it.

function init(FieldContext){
   var title = FieldContext.getFieldValue("Title" );

   if (title == "Temp") {
    FieldContext.hideField("String 000");
     }
   else {
    FieldContext.showField("String 000");
   }
}

 

- Click Ok, Select, Ok, and Submit buttons

 

Note: From the JavaScript above, the Title and "String 000" refers to the "Attribute Name" not "Name"

Additional Information

If the attribute you want to check is Read/Write, see the document below

How to Change Field Display Properties Dynamically

 

Note: The attribute will be shown/hidden after you type the value and change to another field.