I want to Filed Mandatory and Read-Only

JVINAY
Tera Contributor

Hi Team,

 

My Requirement:

I want the field it_fun_org (a reference field to the Business_app table) to behave as follows:

  • It should be mandatory when the form loads.
  • It should be read-only always, regardless of whether it has a value or not.
  • The value is populated automatically (not by the user)

I have Tried below steps

  • I created a UI Policy with no conditions (so it always runs).
  • I added UI Policy Actions to make it_fun_org both mandatory and read-only.
  • The mandatory part works fine.
  • But the read-only setting is not taking effect — the field is still editable.

and I have created OnLoad Client script:

 

function onLoad() {
// Make the field mandatory
g_form.setMandatory('it_fun_org', true);

// Make the field read-only
g_form.setReadOnly('it_fun_org', true);
}

 

But its working on Form mandatory only not working on ReadOnly

Please help to How can  I achieve this.

5 REPLIES 5

Ehab Pilloor
Mega Sage

Hi @JVINAY,

 

You need to revisit your requirement as Mandatory and Read Only cannot be set for a field at same time.

 

Regards,

Ehab Pilloor