How to set value for a drop down list and make the field readonly

Kaushik Ghosh
Tera Contributor

There is one field where the value needs to be set as Break-fix and I need make the field read only. 

The field is for emergency change. I have written a onload client scrip for that field.

function onLoad() {
//Type appropriate comment here, and begin script below
if (g_form.getValue('type') = 'standard'){
g_form.setValue("u_reason_for_change", Break-fix);
g_form.setReadOnly("u_reason_for_change", true);
}
}

The code is not working for this field, could you please help to fix it?


1 ACCEPTED SOLUTION

Amit Gujarathi
Giga Sage
Giga Sage

HI @Kaushik Ghosh ,
I trust you are doing great.
Please refer below script for the same.

function onLoad() {
    if (g_form.getValue('type') == 'standard') {
        g_form.setValue("u_reason_for_change", "Break-fix");
        g_form.setReadOnly("u_reason_for_change", true);
    }
}

Was this answer helpful?


Please consider marking it correct or helpful.


Your feedback helps us improve!


Thank you!


Regards,


Amit Gujrathi



View solution in original post

5 REPLIES 5

Samaksh Wani
Giga Sage
Giga Sage

Hello @Kaushik Ghosh 

 

I think You have not give Inverted Commas on Break-Fix thats why it is Coming,

 

Can you plz Mark my Solution as Accept, The main issue was for double equals to.

 

Regards,

Samaksh