[development] How to validate a $node?

Adrian Rossouw adrian at bryght.com
Wed Jun 7 09:53:07 UTC 2006


On 07 Jun 2006, at 5:07 AM, Moshe Weitzman wrote:

>
> unfortunately, 4.7 is a bit of an intermediate solution which makes  
> this hard. the conceptual way to do is is to programtically  
> "submit" the story form. In 4.7, this amounts to populating the  
> proper $_POST variables like 'type' and 'title' and so on and then  
> building the node form by calling the right functions and then  
> calling drupal_get_form(). the node form is the most complex of all  
> our forms so i'm not sure this works right.
>
> form api 2.0 will be focused on making things like this easy again.
My goal with FAPI 2.0 is something like the following :

$node = drupal_request_model('node/add/event'); // provides a pre- 
populated post request.
$node['title'] = 'something';
$node['body'] = 'something else goes here';
$result = drupal_submit_request('node/add/event', $node); // triggers  
all the fapi validation and submission code.

But for all forms.




--
Adrian Rossouw
Drupal developer and Bryght Guy
http://drupal.org | http://bryght.com




More information about the development mailing list