Page 1 of 1

JScript - Disable the field / make the field view-only

Posted: Tue Oct 31, 2017 5:54 am
by fibo2358
Hello,

I would like to change the "display mode" of a Dynaform field to "disable" or "view" using javascript.
I have tried several combinations like
getFieldById("field_id").disabled = true;
getFieldById("field_id").el.disabled = true;
getFieldById("field_id").readonly = true;
getFieldById("field_id").el.readonly = true;
but nothing works.
Could you please help?

Best Regards,
fibo2358

Re: JScript - Disable the field / make the field view-only

Posted: Tue Oct 31, 2017 6:50 am
by programerboy
Hi,

You can use like this:
Code: Select all
$("#textVar001").getControl().attr('disabled', true);
Thanks

Re: JScript - Disable the field / make the field view-only

Posted: Tue Oct 31, 2017 9:35 pm
by amosbatto
You can also use for text and textarea fields:
$("#fieldID").getControl().prop("readonly", true)

Re: JScript - Disable the field / make the field view-only

Posted: Mon Nov 06, 2017 8:32 am
by fibo2358
Hello,

Thank you for the answers. I have applied the first solution and it works OK.

Best Regards,
fibo2358