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

  • RT @usonian: New post: Ship in the Clouds: Clawhammer Banjo Tablature http://tinyurl.com/y8uvxoc 5 years 12 weeks ago
  • New post: Ship in the Clouds: Clawhammer Banjo Tablature http://tinyurl.com/y8uvxoc 5 years 12 weeks ago
  • RT @godfly: Employee. You are the engine that drives this economy. Too bad you’re not the driver. 5 years 13 weeks ago
  • Hey FYE: reason your Keene store might be closing: your 30% off liquidation prices are still about 20% more than Amazon. Good riddance. #fb 5 years 13 weeks ago
  • Haw. Did a google search including the word 'bathtub'. Sponsored ad next to results: "Dinner with John Lithgow" #fb 5 years 13 weeks ago

Older

Contact

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