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

asimmonds’s picture

Component: forms system » documentation

It 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.

wim leers’s picture

Serious bug in the docs.

Not sure yet how I could update the docs, but if I can, I'll try to tomorrow.

pwolanin’s picture

Project: Drupal core » Documentation
Version: 6.0-rc1 »
Component: documentation » Documentation in CVS

Anyone 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.

webchick’s picture

Status: Active » Fixed
pwolanin’s picture

Status: Fixed » Needs work

@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.

webchick’s picture

#element_validate is not in 5.x/4.7.x? Why do we need to update it there?

pwolanin’s picture

@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)

betz’s picture

Project: Documentation » Drupal core
Version: » 7.x-dev
Component: Documentation in CVS » documentation

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

jhodgdon’s picture

Version: 7.x-dev » 5.x-dev

As 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.

jhodgdon’s picture

Status: Needs work » Fixed

Actually, 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.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.