Closed (fixed)
Project:
Drupal core
Version:
5.x-dev
Component:
documentation
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
6 Jan 2008 at 21:34 UTC
Updated:
8 Jul 2009 at 17:50 UTC
Looking at http://api.drupal.org/api/file/developer/topics/forms_api_reference.html for #validate yields an example of it's usage in filter.module:
$form['format'][$format->format] = array(
'#type' => 'filter_format',
'#title' => $format->name,
'#default_value' => $value,
'#return_value' => $format->format,
'#parents' => array('format'),
'#description' => theme('filter_tips', _filter_tips($format->format, false)),
'#validate' => array('filter_form_validate' => array()),
);
However, the filter.module in D6-rc1 doesn't use #validate there, it uses #element_validate in the $form:
$form = array(
'#type' => 'fieldset',
'#title' => t('Input format'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#weight' => $weight,
'#element_validate' => array('filter_form_validate'),
); The aforementioned reference document makes no mention of #element_validate, which is a bug, along with the fact that its example is outdated.
Comments
Comment #1
asimmonds commentedIt is mentioned in the 5.x->6.x upgrade docs, http://drupal.org/node/144132#element-validate including a valid 6.x example.
Changing to the documentation queue.
Comment #2
wim leersSerious bug in the docs.
Not sure yet how I could update the docs, but if I can, I'll try to tomorrow.
Comment #3
pwolanin commentedAnyone with CVS access can fix this, it's not a core bug
checkout using your contrib CVS account HEAD from contributions/docs/developer
fix the docs (painful HTML editing...) as I have done for #ahah, #submit etc
post the patch here.
commit the changes.
Comment #4
webchickLooks like this was fixed: http://api.drupal.org/api/file/developer/topics/forms_api_reference.html...
Comment #5
pwolanin commented@webchick - I fixed it in the HEAD (6.x) docs 3 weeks ago but someone needs to do the same for 5.x (and 4.7.x?).
http://cvs.drupal.org/viewvc.py/drupal/contributions/docs/developer/topi...
Unfortunately the docs have diverged enough, that I don't think one can re-use the same patch. However, if you look at the diff you can probably re-use chunks of it.
Comment #6
webchick#element_validate is not in 5.x/4.7.x? Why do we need to update it there?
Comment #7
pwolanin commented@webchick - in 5.x, 4.7.x #validate can be set on an individual element - I think it was just renamed to #element_validate for greater clarity in 6.x, but the mechanism is the same (and is not correctly documented now on api.d.o)
Comment #8
betz commentedChanged the component to reflect the new component categorization. See http://drupal.org/node/301443
Comment #9
jhodgdonAs noted in comments above, this has already been fixed for Drupal 5.x and 6.x. If someone wants to fix it for 5.x, they can.
Comment #10
jhodgdonActually, it looks as though the example for 5.x is valid (comes straight verbatim from the filter module). So I think this is actually fixed.