欢迎各位兄弟 发布技术文章
这里的技术是共享的
I have a text field which displays the username. The user should not be able to edit the text field values. Can anyone help me on this?
Thanks,
Sagar.
Hi,
You could try adding one of the following attributes to your text field:
$form['username'] = array(
'#type' => 'textfield',
'#title' => t('username'),
'#attributes' => array('readonly' => 'readonly'),
);
$form['username'] = array(
'#type' => 'textfield',
'#title' => t('username'),
'#attributes' => array('disabled' => 'disabled'),
);
- p
Thank your.
I have been trying
'#readonly' => ture,
'#readonly' => readonly,
Is not correct..
but use '#disabled' => ture, Is feasible
Thank you very much ..
'#attributes' => array('readonly' => 'readonly'),
edian tenan...
it's work, the field became grey, thank's
...
Where exactly does this field appear?
If it's the one in the profile page, you should go to the permissions settings and un-check the relevant permission.