The documentation for hook_validate() (see http://api.drupal.org/api/function/hook_validate/6) explains:

"If it is really necessary to change the node at the validate stage, you can use function form_set_value()."

The documentation for form_set_value() explains that form_set_value() has $form_state as third argument. $form_state is not an argument for hook_validate() and so without more knowledge unknown inside hook_validate().

Comments

dman’s picture

Um yeh. There is some inconsistancy there.
I believe that
hook_validate() is actually a version of {node_type}_validate() which validates whether a node is OK to save.
This is a bit different from form validation functions {formname}_validate() which the docs appear to be referring to, and does/should have the $form_state param.

It appears we have two different hook_validate() templates.
Or I'm also confused.
Needs clarification indeed.

brianV’s picture

Version: 6.6 » 7.x-dev

This inconsistency exists in both D6 and D7.

This documentation was perfectly valid for D5. In D5, form_set_value took $form as an argument rather than $form_state.

jhodgdon’s picture

Status: Active » Closed (duplicate)