[support] textarea readonly

Gordon Heydon gordon at heydon.com.au
Wed May 3 23:06:18 UTC 2006


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.



More information about the support mailing list