[documentation] [Documentation bug] Description of the nodeapi 'validate' action is inaccurate in 4.7 api

toemaz drupal-docs at drupal.org
Fri Nov 3 19:19:29 UTC 2006


Issue status update for 
http://drupal.org/node/92722
Post a follow up: 
http://drupal.org/project/comments/add/92722

 Project:      Documentation
 Version:      <none>
 Component:    Developer Guide
 Category:     bug reports
 Priority:     normal
 Assigned to:  Anonymous
 Reported by:  toemaz
 Updated by:   toemaz
 Status:       active

Good description.


I don't know who is in charge to commit this change. What would it take
to push this adjustment?




toemaz



Previous comments:
------------------------------------------------------------------------

Fri, 03 Nov 2006 13:01:24 +0000 : toemaz

Source: http://api.drupal.org/api/4.7/function/hook_nodeapi


Quote:
"validate": The user has just finished editing the node and is trying
to preview or submit it. This hook can be used to check or even modify
the node. Errors should be set with form_set_error().


This is not correct. The validate action can only be used to check the
submitted form variables. The submit action should be used to modify the
node.


Proposed solution:  Add the submit action in the list.
"validate": The user has just finished editing the node and is trying
to preview or submit it. This hook can be used to check the node. Errors
should be set with form_set_error().

"submit": The user is about to submit the node. This hook can be used
to modify the node.




------------------------------------------------------------------------

Fri, 03 Nov 2006 14:41:25 +0000 : pwolanin

Here's the current text of "submit", which seems ok to me:



"submit": The node passed validation and will soon be saved. Modules
may use this to make changes to the node before it is saved to the
database.

Also, I think the "validate" phase could be used to modify the node via
form_set_value:


http://api.drupal.org/api/4.7/function/form_set_value


though, obviosuly this is not as simple as modifying it during the
"submit" phase






More information about the documentation mailing list