Errata (First Edition)
This page lists the errors found in the first edition of the book.
Chapter 10. The Form API, Page 159
Tue, 06/12/2007 - 1:53pm — soxofaan#markup
markup
The value of the form property #type should be markup instead of #markup (as in the listing below that paragraph).
Chapter 10. The Form API, Page 162
Sat, 05/10/2008 - 6:14am — TUcThe form definition has set the optional $form['#base'] property to foo.
The book states that Drupal will look for theme functions called:
bluebeach_formexample_foo()
phptemplate_formexample_foo()
theme_formexample_foo()
These functions are incorrectly named, because drupal will look for "theme name" plus $form['#base']
The same issue with the validation and sumission functions:
formexample_foo_validate()
formexample_foo_submit()
bluebeach_foo()
phptemplate_foo()
theme_foo()
And for the validation en submission functions:
foo_validate()
foo_submit()
incorrectly named functions
Chapter 10. The Form API, Page 163
Sun, 05/04/2008 - 10:05am — chachalacaOmission of the $form argument in the hook_validate() sig if you are using form_set_value().
Show the needed $form argument in the _validate() signature:
_validate($form_id, $form_values, $form) {
...
It would be helpful to show how the $form variable became available in the form_set_value() statement.
Chapter 10. The Form API, Page 165
Sat, 11/17/2007 - 8:24am — NikLPif (!in_array($element['#value'], $allowed_flavors) {
if (!in_array($element['#value'], $allowed_flavors)) {
Code error, missing right bracket.
Chapter 10. The Form API, Page 165
Sat, 11/17/2007 - 8:28am — NikLPform_error($element, t('You must enter spicy or sweet.');
form_error($element, t('You must enter spicy or sweet.'));
Form_error missing right bracket.
Chapter 10. The Form API, Page 165
Mon, 06/25/2007 - 3:08pm — rcharneyUnlike the other hooks in this section, the form_alter hook takes just the module name as a prefix, not the form name. Thus, the function's signature is modulename_form_alter($form_id, &$form).
Clarification
Chapter 10. The Form API, Page 167
Fri, 04/27/2007 - 4:19pm — jvandyk'access' => user_access('access_content')
'access' => user_access('access content')
The access content permission is not written with an underscore.
Chapter 10. The Form API, Page 172
Mon, 06/25/2007 - 3:13pm — rcharneyIncorrect function signatures for foo($form_id, $form) and bar($form_id, $form)
The signatures should have references to the $form variable:
foo($form_id, &$form) and
bar($form_id, &$form)
Missing reference markers.
Chapter 10. The Form API, Page 175
Tue, 06/12/2007 - 1:49pm — soxofaan#after_field
#field_suffix
#after_field is not a valid property, #field_suffix is the right one.
Chapter 10. The Form API, Page 176
Tue, 06/05/2007 - 10:44am — antinomiaProperties commonly used with the password element are #attributes, #default_value, #description ...
Properties commonly used with the password element are #attributes, #description ...
#default_value is not a valid property of the password element. See: http://drupal.org/node/67519
