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.

Also

Tags

Syndicate content

Twitter

  • I always wonder about folks who take 15 minutes at the ATM. have they never used one before? 5 years 7 weeks ago
  • @EricLondon teen spirit link FAIL http://is.gd/7yJIi 5 years 7 weeks ago
  • @EricLondon http://en.wikipedia.org/wiki/Teen_Spirit_(deodorant) 5 years 7 weeks ago
  • Good luck to all you folks attempting the RPM Challenge this month. I'll find the time to join you one of these years. #fb 5 years 7 weeks ago
  • Protip: don't accidentally blacklist google's tld when test driving SelfControl.app. 5 years 7 weeks ago

Older

Contact

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