Closed (works as designed)
Project:
Drupal core
Version:
7.17
Component:
forms system
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
10 Nov 2012 at 17:07 UTC
Updated:
11 Mar 2013 at 18:31 UTC
#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
Comment #0.0
Blooniverse commented(ps) Formatting improvements.
Comment #0.1
Blooniverse commented(ps) Adding stuff before someone can answer.
Comment #0.2
Blooniverse commented(ps) Some more last changes.
Comment #0.3
Blooniverse commented(ps) English grammar. Hm ...
Comment #1
Blooniverse commentedTitle is more legible for humans now.
Comment #2
Blooniverse commented... btw, is there a reason to NOT just delete these attributes?
readonlyanddisabledcan both be implemented as shown above.
Comment #3
Blooniverse commentedRemoving wrongly set tags.
Comment #4
Blooniverse commentedChanging title and updating initial post (see
<del>part).Still, I think that ...
#default_valueseems [to me] completely unnecessary since one can/should use#valueinstead -- 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 (!):
Comment #5
naxoc commented#disableddoes not go in the attributes array: http://api.drupal.org/api/drupal/developer%21topics%21forms_api_referenc...#default_valueis 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.
Comment #5.0
naxoc commented(ps) Update via
for clarity reasons.