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

  • RT @Crell An obituary for an old friend: http://bit.ly/gNdVIl #Drupal #Git #CVS 3 years 21 weeks ago
  • (That is to say, in hook_views_data(). #views #drupal) 3 years 21 weeks ago
  • #drupal #views3 gurus: Is it possible to declare a relationship with an intederminate base table & field? (TBD by the handler?) 3 years 21 weeks ago
  • I wrote a module and someone else figured out how to use it to pull Webform data into #Drupal views. http://bit.ly/hGDGGi 3 years 27 weeks ago
  • RT @nquabbinlodge Meeting tonight in Athol MA! Work of the evening: confer the 3rdº on 1 candidate. Dinner at 6, lodge opens at 7. 3 years 32 weeks ago

Older

Contact

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