Forums

Enable/disable field with custom code or php

Lorentz 31 Jul, 2018
Hi,

Is it possible to enable/disable a field with a custom code or a php code.

I've tried using this option but it seems not to work.

is there something like $this->set/disable(fieldname) ?
healyhatman 31 Jul, 2018
sure have your custom code or PHP return "disabled" and in the Disabled field of the field setup use {var:customcodename}
Lorentz 31 Jul, 2018
Thanks a lot !

I've totally forgot this way to do :@

EDIT: not fully working as expected
Lorentz 31 Jul, 2018
I missed something,

If I don't set {var:customcodename}, or return empty, or NULL, the field stay disabled.

any idea ?
healyhatman 31 Jul, 2018
return empty or null then?
Or put it in extra attributes instead
healyhatman 07 Aug, 2018
Move the {var:} to your "class" field. When you want it to be disabled make sure it's returning "disabled", and it will add the disabled class. Probably won't work properly though I dare say you need to put it in extra attributes.
This topic is locked and no more replies can be posted.