g_form.setDisabled not making checkbox variable grayed out on platform view

shikha Gandhi
Tera Contributor

I have on change catalog client script to make checkbox variable grayed out using g_form.setDisabled function.

 

Same function making checkbox grayed out in portal view but in internal view not working.

 

Is there any restriction g_form.setDisabled() function don't work on platform view.

9 REPLIES 9

Sandeep Rajput
Tera Patron
Tera Patron

@shikha Gandhi Did you try g_form.setReadOnly()? please see if it works.

Community Alums
Not applicable

Hi @shikha Gandhi ,

This method is used to disable the field and make it unavailable when boolean value in true and enable and avaialalbe when boolean value in false.

But, if we want that field only become read only then we can use:
g_form.setReadOnly(string fieldname, booleanvalue);

 

Please chcek image for reference

 

SarthakKashyap_0-1715884604189.png

 

 

Please mark my answer correct and helpful if this works for you

Thanks and Regards 

Sarthak

Already tried  g_form.setReadOnly(), still same issue working in platform view not in internal view.

 

Robbie
Kilo Patron
Kilo Patron

Hi @shikha Gandhi,

 

This can easily be achieved by leveraging the g_form API and .setReadOnly() method.

Use the below syntax as appropriate:

 

g_form.setReadOnly('field_name', true); //Use true to make the field read only. (Alternatively, swap the value of true to false to make the field editable again)

 

To help others (or for me to help you more directly), please mark this response correct by clicking on Accept as Solution and/or Kudos.

 

Thanks, Robbie