#default_value and #disabled (boolean or 'disabled') don't work! I can drupal_render() as long as the day has hours, but these attribs don't work. Both don't occur in the rendered output. I am aware of issue #426056: Server-side enforcement of #disabled is inconsistent . It's just that I didn't expect v7.17 to be so foundationally faulty, still.

Btw, successful are, quite obviously, following work-arounds:

  • '#attributes' => array('readonly' => 'readonly'), resp.
  • '#attributes' => array('disabled' => 'disabled'), or both at once
  • '#attributes' => array('readonly' => 'readonly', 'disabled' => 'disabled'),

Comments

Blooniverse’s picture

Issue summary: View changes

(ps) Formatting improvements.

Blooniverse’s picture

Issue summary: View changes

(ps) Adding stuff before someone can answer.

Blooniverse’s picture

Issue summary: View changes

(ps) Some more last changes.

Blooniverse’s picture

Issue summary: View changes

(ps) English grammar. Hm ...

Blooniverse’s picture

Title is more legible for humans now.

Blooniverse’s picture

Title: Input textfield attribs #default_value & #disabled don't work! » Textfield input attribs #default_value & #disabled don't work!

... btw, is there a reason to NOT just delete these attributes?

  • readonly and
  • disabled

can both be implemented as shown above.

Blooniverse’s picture

Removing wrongly set tags.

Blooniverse’s picture

Title: Textfield input attribs #default_value & #disabled don't work! » Textfield input attrib #disabled doesn't work!

Changing title and updating initial post (see <del> part).

Still, I think that ...
#default_value seems [to me] completely unnecessary since one can/should use #value instead -- especially since this attribute doesn't even exist in HTML, actually! It merely lives in Javascript. Well, I handle it in this manner and things do work all fine/better!

I guess, one/we should be careful to not confuse HTML and Javascript in the development logic (!):

naxoc’s picture

Status: Active » Closed (works as designed)

#disabled does not go in the attributes array: http://api.drupal.org/api/drupal/developer%21topics%21forms_api_referenc...

#default_value is very distinct from #value: http://api.drupal.org/api/drupal/developer%21topics%21forms_api_referenc...

This isn't a bug, so I am closing this issue.

naxoc’s picture

Issue summary: View changes

(ps) Update via for clarity reasons.