I have functionality set up where an admin can create a user with a content profile. The content profile has a required field but I want the user himself to fill it out. How can I disable the required-ness of that field when the admin is creating the user so he can submit the form. I tried setting #required to 0 or unsetting it, but that does nothing.
function mymodule_form_contenttype_node_form_alter(&$form, &$form_state) {
$form['field_reviewer_instruments']['#access'] = FALSE;
$form['field_reviewer_instruments']['#required'] = FALSE;
}
hook_form_alter()
? It should be as simple as implementinghook_form_alter()
and setting$form['field']['#required'] = FALSE;
Then again, I think unsetting the attribute should work as well. Are you sure the hook is being called correctly? Maybe if we see the code you're using we can spot the problem.#access
not working either? Is the hook implementation displaying test messages properly?