[development] Unsetting form values on validate

Michael Prasuhn mike at mikeyp.net
Tue Oct 21 03:05:29 UTC 2008

I am building a directory listing type site and trying to keep all my  
listings in one node type. There are different options for the types  
of listings available, and I am using some javascript to show/hide  
forms on the node/add page. I am also doing quite a bit of validation  
from hook_nodeapi, of individual field formatting, and so on. One of  
the things I'd like to be able to do, is upon validation of the node,  
throw out any form values that do not match the type of listing they  
have chosen (so that the values won't be shown on the node preview,  
for example).

What is the best way to go about this? I see that in my hook_nodeapi  
under the validate op, I am getting the node, and the $form itself,  
not $form_state or $form_values. The submitted data that I wish to  
discard is in both the $node object, and the $form array under #post  
among other places.

Drupal 6.x btw.

Michael Prasuhn
mike at mikeyp.net

More information about the development mailing list