Hello

I need to have a edit form that includes some fields. One of the fields is not editable. I can use this in my html code

<input type="text" name=myText value="Enter Your Name" readonly>

Could you please tell me how to do it using drupal

Many thanks
john

Comments

Webform module

Not sure what you're after but may be you can give webform module a try:
- http://drupal.org/project/webform

With this module you can design forms with different kind of fields. These forms can be submitted (as a result e-mails can be sent), and all data will be stored in the database.

___________________
discover new oceans
lose sight of the shore

___________________
discover new oceans
lose sight of the shore

#READONLY = true unavailable

I believe what johnhelen is getting at is that although drupal's form api supports the '#disabled' attribute, it doesn't support the 'readonly' attribute. They were both introduced in html 4.0 with the primary difference, I believe, is a disabled form input submits no value whereas a readonly input will submit the default value.

In my mind this is a bug in the form.inc of Drupal.

Try #attribute

I have not tried this in 4.7 but it works for 5.1

if you're using _form_alter hook

$form['account']['name']['#attributes'] = array('readonly' => 'readonly');

or $form items

'#attributes' => array('readonly' => 'readonly');

or use array('disabled' => 'disabled');

Chris Herberte

Yep, that does it - thanks

Yep, that does it - thanks Chris, almost 3 years later w/ D6.15!

Any idea for Drupal 7. Thanks

Any idea for Drupal 7.
Thanks