Need to make the field readonly

suuriya
Tera Contributor

Hi,

 

I have a requirement, when status is retired or transferred then Hosting information(u_what_type_of_3rd_party_hosting) field need to be read only but I have other requirement so based on that i have written this code.

 

This script will make the field editable based on selecting the value from other field...but now when the status is changed to retired or transferred then the field needs to be readonly.....On top of the script i have added if condition it works (field became readonly) but throwing an error near the on change field.

 

 

 

What is the best way to achieve this.

 

Thanks in advance.

 

1 ACCEPTED SOLUTION

@suuriya change line number 9 and 10 to below 

var status = g_form.getValue('install_status');

if(status!="270")

 

Basically to explain in a simple way you need to use get Value to access some field value on form and you cant write the field name directly like install_status .In your script in line no 9 you directly wrote install_status which script cant recognise as there is no such thing called install status.

But when you change it to above script which i gave ..i used get value and stored it in some variable and used that variable in if statement to compare the value .

 

Hope this helps 

Mark the answer correct if this helps you 

Thanks

View solution in original post

8 REPLIES 8

Mohith Devatte
Tera Sage
Tera Sage

Hello @suuriya ,

can you please paste the entire screenshot of the error .In the image that you provided top part is missing 

Hi @Mohith Devatte 

,

Here is the top part.

 

 

@suuriya ,

you must have used "install_Status" field name directly in your script instead of g_form.getValue('install_status');

 

try replacing it with above and the error might go away.

 

Hope this helps 

Mark the answer correct if this helps you 

Thanks

Hi @Mohith Devatte ,

 

I have written this but still the error shows