Closed (fixed)
Project:
Documentation
Component:
Developer Guide
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
3 Nov 2006 at 13:01 UTC
Updated:
21 Feb 2007 at 21:00 UTC
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.
Comments
Comment #1
pwolanin commentedHere's the current text of "submit", which seems ok to me:
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
Comment #2
toemaz commentedGood description.
I don't know who is in charge to commit this change. What would it take to push this adjustment?
Comment #3
pwolanin commented@toemaz - which description are you in favor of? The one I quoted is already part of the docs. The "validate" op should be changed as you originally suggested.
Anyone with CVS access (including me) can commit changes to the develper docs.
Comment #4
toemaz commentedWell, I like your description on the 'submit' action. I would not add the extra information with the form_set_value. Keep it simple.
Comment #5
Tresler commentedCurrently reads:
This seems to be what the initial issue was opened to clarify.
Marking closed and assigning self for tracking if re-opened.
Comment #6
Tresler commentedComment #7
(not verified) commented