The code and comments in this function imply that you can change the value of the node (set quantity to 0 as a default). But changes made here are ignored; all you can do in this method is validate the existing values (and call hook_nodeapi if you need to set a value).

Comments

jhodgdon’s picture

Project: Drupal core » Examples for Developers
Version: 6.x-dev » 6.x-1.x-dev
Component: documentation » Node Example

This may have already been fixed... The example modules are now being maintained in a separate project, and unforunately, the most up-to-date ones are not on api.drupal.org yet. Sigh.

rfay’s picture

Status: Active » Fixed

I don't see the problem here.

Here is the current node_example_validate():

/**
 * Implementation of hook_validate().
 *
 * Our "quantity" field requires a number to be entered. This hook lets
 * us ensure that the user entered an appropriate value before we try
 * inserting anything into the database.
 *
 * Errors should be signaled with form_set_error().
 */
function node_example_validate($node) {
  if ($node->quantity) {
    if (!is_numeric($node->quantity)) {
      form_set_error('quantity', t('The quantity must be a number.'));
    }
  }
}

Status: Fixed » Closed (fixed)

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