Hidden Bind

The Data Validation 'Hidden' bind allows running a JavaScript-based business condition that hides selected attributes and references from the user in the Web UI.

All 'Hidden' methods are available in the Technical Documentation accessible at [system]/sdk or from the system Start Page.

For general information about the Data Validation binds, refer to the topic Data Validation Binds.

Note: The Data Validation Hidden bind should not be used to limit user access to attributes and references. An object that has been hidden via the Hidden bind continues to include the data in the browser which makes it accessible. Alternatively, using privilege rules to hide objects prevents values like personal IDs from being included in a browser. Therefore, when possible, use a User Group to allow or limit access. For more information, refer to the topic Privilege Rules in the System Setup documentation.

Important: Careful testing is recommended when using the Hidden Bind.

  • When updated parameter values become hidden due to other configured validation, the updated value is saved even while the parameter is hidden.

  • When a mandatory parameter becomes hidden, the user may not be allowed or even recognize that a mandatory value is missing.

This bind is found within the 'Binds to' dropdown, as shown below.

Configuration

To use any bind:

  1. Create a business rule as defined in the Creating a Business Rule, Function, or Library topic.

  2. Edit the business rule as defined in the Editing a Business Rule or Function topic.

  3. In the Edit Operation dialog, add the bind to a business rule, as defined in the Adding a Bind topic in the Resource Materials online help documentation.

  4. In the Edit Operation dialog, optionally add Messages, as defined in the Localized Messages for JavaScript Business Rules topic.

  5. In the Edit Operation dialog, add JavaScript to call the bind.

Examples

The following JavaScript examples use the related bind(s).

Important: Example scripts should not be used as-is without thorough testing, including updating the script to match object and link types that exist on your system. JavaScript variable names are case-sensitive.

Note: To update validated attributes dynamically in the Web UI, business conditions applied via the legacy options for the Per Screen - Validation or the Main - Advanced must include an Attribute Value bind for each attribute that should be validated via the business condition. This bind is not required for Web UI validation using the preferred Global Representation List option since the Triggering Data Types parameter provides validation as values are changed. For details, refer to the topic Configuring Business Conditions in Web UI.

Hide attribute based on another attribute's value

In this example, one attribute displays based on the value in another attribute. The business condition running for the Node Editor screen verifies if the value of the attribute 'SoundInput' is 'Mono,' then the attribute 'PrintType' (with the Web UI label 'Type') is hidden from the user. If any value other than 'Mono' is entered in this field, the 'PrintType' attribute is visible.

Copy
var attrHome = manager.getAttributeHome();
// Hidden
if (soundInput == "Mono"){
hidden.setHidden(currentObject, attrHome.getAttributeByID ("PrintType"));
}

return (true);  

In the example JavaScript, the 'setHidden' method hides the 'Type(PrintType)' attribute if the 'SoundInput' attribute's value is set to 'Mono.'

In the Web UI Node Editor image below, the Type attribute is displayed or hidden, based on the Sound Input value.

Hide attribute(s) until needed

Another example uses the Hidden bind to display attributes as needed by hiding fields until a value has been entered for a previous field. For example, a list of feature bullets should not allow a user to enter a value for the third attribute until the first two attributes have values.

Copy
var attrHome = manager.getAttributeHome();
var bullet1A = attrHome.getAttributeByID("FeatureBullet1");
var bullet2A = attrHome.getAttributeByID("FeatureBullet2");
var bullet3A = attrHome.getAttributeByID("FeatureBullet3");

mandatory.setMandatory(currentObject, bullet1A);
mandatory.setMandatory(currentObject, bullet2A);

if (bullet1==null) {
logger.info("Hiding Bullet02");
hidden.setHidden(currentObject, bullet2A)
}
if (bullet2==null) {
logger.info("Hiding Bullet03");
hidden.setHidden(currentObject, bullet3A)
}

return true;

In the example JavaScript, the following conditioning is applied to the attributes:

  • 'Feature Bullet 1(FeatureBullet1)' is set as mandatory and a standard message is used.

  • 'Feature Bullet 2(FeatureBullet2)' is set as mandatory and a standard message is used.

  • 'Feature Bullet 2(FeatureBullet2)' is hidden if there is no value for 'Feature Bullet 1'.

  • 'Feature Bullet 3(FeatureBullet3)' is hidden if there is no value for 'Feature Bullet 2'.

While setting two attributes as mandatory, this JavaScript ensures that the bullet text is added in numerical order.

In the Web UI Node Editor image below, the Feature Bullet 1 attribute is displayed and shown to be mandatory. Notice that although Feature Bullet 2 is also mandatory, it is not displayed until Feature Bullet 1 has a value, but the error counter indicates that there are 2 errors because there are two mandatory attributes.

When a value is added for Feature Bullet 1, Feature Bullet 2 is displayed.

When a value is added for Feature Bullet 2, Feature Bullet 3 is displayed. Since Feature Bullet 3 is not mandatory, the error counter is removed.

Hide attributes and references inside data containers

The Hidden bind facilitates the execution of a JavaScript-based business condition for attributes and globally configured references inside the Globally Configured Unfolding Data Container and the Globally Configured Multi Edit Data Container. This enables users to mark selected attributes and globally configured references as hidden within these data containers.

The Hidden bind can be made valid for specified attributes and globally configured references within a specific data container type or data container instance.

Copy

var attrHome = manager.getAttributeHome();
var phoneDCInstances = currObj.getDataContainerByTypeID("PhoneDataContainer");
var phoneArray = phoneDCInstances.getDataContainers();
var phoneUserRefType = manager.getReferenceTypeHome().getReferenceTypeByID("PhoneUser");
var manualQualityEvalAtt = attrHome.getAttributeByID("Manual Quality Evaluation");

phoneArray.forEach(o =>  {
var dcInstance = o.getDataContainerObject();
var isPrimary = dcInstance.getValue("IsPrimary").getSimpleValue();

if (!isPrimary || isPrimary == "No"){
hidden.setHidden(dcInstance, manualQualityEvalAtt);
hidden.setHidden(dcInstance, phoneUserRefType);
}

});

return true;

The below example shows two instances of the same phone data container type within the Globally Configured Unfolding Data Container. The first data container displays all the configured fields, whereas the second data container conditionally hides the last two attribute fields. The second data container is set up with a business condition that ensures that if the value ‘Yes’ is selected for the attribute ‘Is Primary’, the additional fields ‘Phone Adm. Contact’ and ‘Manual Quality Evaluation’ display.

Within the Globally Configured Multi Edit Data Container, users can mark entire columns or individual cells as hidden.

Hidden columns will not be visible in the data container table. In the following example, the ‘Currency’ attribute is displayed based on the value of the ‘Region’ attribute.

If USA’ is selected in the ‘Region’ field, the ‘Currency’ column is hidden, as it is no longer relevant for selection.

Hidden cells will be displayed in gray as in the example below.