Hi. For one of my module I need to make a form (no problem) with "name" and "email" textarea data. If a user is logged I can get this data via user_load(), so I want to make this two data readonly in the form. Is this possible ?
Tnx.
michel ziobudda morelli wrote:
Hi. For one of my module I need to make a form (no problem) with "name" and "email" textarea data. If a user is logged I can get this data via user_load(), so I want to make this two data readonly in the form. Is this possible ?
Tnx.
Yes. One method is to add an attributes element to your form array. For example:
$form['yourform'] = array('#type' => 'textarea', '#attributes' => array('disabled' => 'disabled'), );
..chrisxj
Yes. One method is to add an attributes element to your form array. For example:
$form['yourform'] = array('#type' => 'textarea', '#attributes' => array('disabled' => 'disabled'), );
or array('readonly' => 'readonly')
Michel, you should probably ask these questions on the developers' list.
K
Karthik ha scritto:
Yes. One method is to add an attributes element to your form array. For example:
$form['yourform'] = array('#type' => 'textarea', '#attributes' => array('disabled' => 'disabled'), );
or array('readonly' => 'readonly')
Michel, you should probably ask these questions on the developers' list.
Tnx for the reply but why in developers' list ??? Is not the developers' list only for who developer drupal core ???
M.
Hi,
On Wed, 2006-05-03 at 14:29 -0500, Chris Johnson wrote:
michel ziobudda morelli wrote:
Hi. For one of my module I need to make a form (no problem) with "name" and "email" textarea data. If a user is logged I can get this data via user_load(), so I want to make this two data readonly in the form. Is this possible ?
Tnx.
Yes. One method is to add an attributes element to your form array. For example:
$form['yourform'] = array('#type' => 'textarea', '#attributes' => array('disabled' => 'disabled'), );
Be warned that this doesn't stop you from posting to this field. If you are using the firefox webdeveloper extension you can actually enable disabled fields.
So if someone is not using the web interface and just blindly posting data they can post to it.
Gordon.