On 6/7/06, <b class="gmail_sendername">Jim Riggs</b> &lt;<a href="mailto:drupal-lists@jimandlissa.com">drupal-lists@jimandlissa.com</a>&gt; wrote:<div><span class="gmail_quote"></span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
On 7 Jun, 2006, at 3:24, Robrecht Jacques wrote:<br>No, I don't set the required taxonomy, but it will be set if<br>required.&nbsp;&nbsp;The user has to set it.&nbsp;&nbsp;They are presented with a<br>complete node/add form, including taxonomy selection.&nbsp;&nbsp;It's just that
<br>in my case they can import many items via the body textarea.</blockquote><div>...<br>Ah, ok. Only read through the code quickly. So the node/add form already does this validation for you and you don't need to do that validation again. Then indeed a simple &quot;node_validate()&quot; will work. 
<br><br>But in my case there is no node/add form that the user submitted but still i want this form validation to be done somehow.<br><br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
&gt; You also bail out creating quotes from the first error you<br>&gt; encounter while I would like to import the next rows too.<br><br>Yeah.&nbsp;&nbsp;That was just a design decision, though.&nbsp;&nbsp;I could have easily<br>continued the import.
</blockquote><div><br>How?<br>You check form_get_errors(). If this returns something, you know the node_valiate() has failed. But how do you clear out the errors you've already got before the next node_validate() you do in the foreach loop? The errors stay inside a static array in form_set_error() and can not be cleared at all. So the import you try after one with errors will also have some form_get_errors()... in fact, the same ones as the first row with errors.
<br><br>Your code works, but unfortunately I can't use it as I need to do the &quot;user presses submit on the node/add form&quot; programmatically too.<br><br>Thx,<br>Robrecht<br></div></div><br>