Catalog UI policies getting overridden by a onload client script

abcmh
Giga Contributor

Hello ,

I have a catalog item which has multiple catalog ui policies and action on the variables. The policy and actions hide variables or make them available on selection of

certain variables.

It was working fine until I added an onload client script to make some variables read only onload,.

Basically I have about 6 date variables that were editable and using a calendar control and the user could still type in the date if needed.

it was suggested to make these variables read only and can only be populated by selection from the calendar control. So I added the following script below to make them readonly with calendar control to add the date. All these 6 date variables had a catalog ui policy and action that would make them visible only when certain variables were selected otherwise these date variables will be hidden. However after adding the onload client script all the date variables are now visible all the time and the catalog ui policy is being over ridden

Why would the behavior change when I added the onload client script. The script below makes the variables readonly.

Any input will be appreciated. Thanks.

function onLoad() {
    //Type appropriate comment here, and begin script below
  // Sets the field's background to a gray, making is appear read-only.  
  g_form.getControl('CRE_BC_ContractStartDate').disabled = 'true';  
  // Sets the field read-only  
  g_form.getControl('CRE_BC_ContractStartDate').readOnly=true;  

  g_form.getControl('CRE_BC_ContractEndDate').disabled = 'true';  
  // Sets the field read-only  
  g_form.getControl('CRE_BC_ContractEndDate').readOnly=true;  

  g_form.getControl('CRE_BLR_ReqCompletionDate').disabled = 'true';  
  // Sets the field read-only  
  g_form.getControl('CRE_BLR_ReqCompletionDate').readOnly=true;

  g_form.getControl('CRE_BUO_ContractStDate').disabled = 'true';  
  // Sets the field read-only  
  g_form.getControl('CRE_BUO_ContractStDate').readOnly=true;

  g_form.getControl('CRE_BUO_ContractEndDt').disabled = 'true';  
  // Sets the field read-only  
  g_form.getControl('CRE_BUO_ContractEndDt').readOnly=true;

  g_form.getControl('CRE_OCC_ReqOccupanyDate').disabled = 'true';  
  // Sets the field read-only  
  g_form.getControl('CRE_OCC_ReqOccupanyDate').readOnly=true;

}

5 REPLIES 5

HI Amol,



Client scripts run after UI policies (if memory serves.) So what ever rules you set in the UI policies may be overridden if a client script runs later on the same object.