I had drupal_execute working under Drupal 5.x, but am having trouble getting it to work under Drupal 6.

Under 5.x, drupal_execute worked like this :

$node = array('type' => 'mynodetype');
drupal_execute($form_id, $form_values, $node);

Under 6.x I'm trying this :

$node = array('type' => 'mynodetype');
// a number of lines to setup form_state
drupal_execute('mynodetype_form', $form_state, $node); // this inserts node

I also tried to simply copy and past the sample from the Drupal 6 API docs but this didn't work :

$form_state = array();
$node = array('type' => 'story');
$form_state['values']['title'] = 'My node';
$form_state['values']['body'] = 'This is the body text!';
$form_state['values']['name'] = 'robo-user';
$form_state['values']['op'] = t('Save');
drupal_execute('story_node_form', $form_state, $node);

The Drupal 6 API docs state this :

drupal_execute($form_id, &$form_state)

I guess I'm not clear what the form_id is. Can anyone offer some guidance on this?

Thanks,

David

Comments

DKL64’s picture

I couldn't figure out drupal_execute. For the moment I'm just inserting directly into the database. Not flexible, and probably not recommended, but it works for now.

hedge funds   credit cards
income taxes   debt relief

shunting’s picture

sykic’s picture

that thread no good

it is for drpal 5.x

jinlong’s picture

i have the same problem!

in this code , what does '#type' => 'gmap' mean?

it can run in drupal5,but can not run in drupal6. why not?

thanks a lot!

$form['macroform']['mapdiv'] = array(
    '#type' => 'gmap',
    '#map' => 'macro_map',
    '#settings' => array_merge(array(
      'points' => array(),
      'pointsOverlays' => array(),
      'behavior' => array(
        'dynmarkers' => TRUE,
      ),
    ), $settings),

---------------------------------------------------------------------------
Women Lose Weight-->I would love to lose weight!

jinlong’s picture

i have the same problem!

in this code , what does '#type' => 'gmap' mean?

it can run in drupal5,but can not run in drupal6. why not?

thanks a lot!

$form['macroform']['mapdiv'] = array(
    '#type' => 'gmap',
    '#map' => 'macro_map',
    '#settings' => array_merge(array(
      'points' => array(),
      'pointsOverlays' => array(),
      'behavior' => array(
        'dynmarkers' => TRUE,
      ),
    ), $settings),

---------------------------------------------------------------------------
Women Lose Weight-->I would love to lose weight!

jinlong’s picture

i have the same problem!

in this code , what does '#type' => 'gmap' mean?

it can run in drupal5,but can not run in drupal6. why not?

thanks a lot!

$form['macroform']['mapdiv'] = array(
    '#type' => 'gmap',
    '#map' => 'macro_map',
    '#settings' => array_merge(array(
      'points' => array(),
      'pointsOverlays' => array(),
      'behavior' => array(
        'dynmarkers' => TRUE,
      ),
    ), $settings),

---------------------------------------------------------------------------
Women Lose Weight-->I would love to lose weight!

zimmerleut’s picture

Have you been able to solve this? I'm having the same problem...

jpulles’s picture

Probably the last line should read:

drupal_execute('story_node_form', $form_state, (object)$node);