Drupal version : 7
I want to create nodes by drupal_form_submit(), so i need to know two parameters $form_id and $form_state. I want to create the $form_state values say
$form_state['values']['op'] = t('Save');
$form_state['node'] = $old_node;
$form_state['values'] = array(
'nid' => 123,
'type' => 'blog',
'entity_type'=> 'node',
'field_taxonomy' => 'term1, term2, term3',
'field_textfield' => array('und' => array( 0 => array('value' => 'textvalue1')))),
'field_date' => array('und' => array( 0 => array('date' => '23/07/2012', 'time' => '12:39')))),
);
drupal_form_submit('blog_node_form', $form_state, $old_node);
for various types of fields the form_state array structure is different, say for taxonomy field we need to send values comma (',') seperated. for text fields we need to send as
array( 0 => array('value' => 'textvalue1')),
and it varies from field to field.
How to determine the form structure based on the field name ?
How can i merge the existing form values with the new one in the above form array?