FAPI docs wrong for #hidden fields

rcourtna - October 14, 2007 - 20:26
Project:Documentation
Component:Correction/Clarification
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active
Description

http://api.drupal.org/api/file/developer/topics/forms_api_reference.html...

hidden

Description: Store data in a hidden form field.

Properties: #prefix, #suffix, #type, #value

#default_value is also a property. If you want to allow javascript to modify a hidden field's value, then you have to use #default_value to set the starting value when drawing the form. If you use #value, then javascript changes to the value will not be available in the form's _submit() function.

#1

webchick - October 19, 2007 - 02:47

It's my understanding that giving a field type like hidden or value a #default_value is Very Very Dangerous (tm). I'll check with chx or eaton, but afaik this is a practice greatly discouraged. I'm not sure what the workaround is, however.

#2

nielsbom - August 31, 2008 - 09:10
Component:Developer Guide» Correction/Clarification

Changed the component to reflect the new component categorization. See http://drupal.org/node/301443
-nielsbom

 
 

Drupal is a registered trademark of Dries Buytaert.