Topic “Drupal fapi gotcha”

Drupal 5.x Form API: #value vs. #default_value

This is probably well documented if you look in the right place, but having just spent a number of hours puzzling through it on my own (despite) having access to documentation, I think it bears reiteration:

If you use '#value' when declaring a form element, that value is what will be received after submission, even if applied to a textfield that gets changed by the user. (This makes sense when passing a value behind the scenes, as you would do with a '#value' form element)

Use '#default_value' if you want the end-user to be able to modify the value.

Syndicate content
Syndicate content

Twitter

  • It's about time http://flic.kr/p/8GcTE9 3 years 42 weeks ago
  • Don't use twitter much any more, ayuh. 3 years 44 weeks ago
  • Lazyweb: Does there exist a #drupal module for selectively disabling CCK fields without deleting them? Perhaps field permissions... 3 years 44 weeks ago
  • New post: Old Joe (Minstrel Banjo) http://tinyurl.com/3yyg8g9 3 years 47 weeks ago
  • New post: Emacs Org-mode: Custom agenda that filters by date AND tag http://tinyurl.com/2vnrcl2 3 years 47 weeks ago

Older

Contact

Andy Chase
(978) 297-6402
andychase [at] gmail.com
GPG/PGP Public Key