[development] How to validate a $node?
Robrecht Jacques
robrechtj+drupal at gmail.com
Wed Jun 7 08:24:09 UTC 2006
On 6/7/06, Jim Riggs <drupal-lists at jimandlissa.com> wrote:
>
> You can take a look at my quotes.module. It can import several
> quotes through a single node submission form. Although the concept
> is a bit different from what you are doing, it does have to
> individually validate and submit each quote. You might be able to
> get some hints from it...or give me some hints if you see problems
> with my code! ;-)
The problem with your importing code is exactly what I was pointing out.
Suppose I attach a required taxonomy to the "quotes" content type. You don't
set it. You don't validate it. Still the node is created.
Or if I use hook_form_alter() to add a "#required" to the title textfield so
it must be non-empty... you'll happily save the node without the title set.
You also bail out creating quotes from the first error you encounter while I
would like to import the next rows too.
I may have misread the code.
Now for your specific case, this may be ok, but for a generic node_import it
is not.
Robrecht
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20060607/2ebf015f/attachment.htm
More information about the development
mailing list