How to disable a field or make it readonly in Drupal 7

ε祈祈猫儿з 提交于 2019-11-30 20:45:22
oleg

It works for text fields^

$form['field_secured_title']['und']['0']['value']['#attributes']['disabled'] = TRUE;

Like it said in the docs

You can use attributes :

$form['#attributes'] = array('disabled' => TRUE);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!