I need the ability to grey out fields with non editable permission i.e. to show certain field values to the user but forbid him/her to edit them, upon node editing.
How can i achieve this?
Form elements have a
disabled property you can set as a boolean. For example:
$form['test'] = array( '#type' => 'text', '#title' => t('Test'), '#required' => FALSE, '#default_value' => 0, '#disabled' => TRUE, );
Now, you can use
hook_form_alter() to check that you're on the right form (
$form_id), and any other conditions you require, like for instance checking user permissions, with the
I think the fastest way to achieve what You want is to use jQuery in Your template or custom module: