(sorry I'm spamming your queue, quicksketch)

Been grinding my gears calling functions to create a submission, and nothing seems to work. I thought for sure this would:

$node=node_load(130);
drupal_execute('webform_client_form',array(),$node,array(),TRUE,FALSE);

Any ideas?

Comments

quicksketch’s picture

You might need to add the nid to the client form call. I haven't tested this but it's worth a shot:

$node=node_load(130);
drupal_execute('webform_client_form_130', array(), $node, array(), TRUE, FALSE);
lefnire’s picture

it's weird, both those webform_client_form() and webform_client_form_130() create a row in {webform_submissions}, but neither submissions are available in /node/130/results or /node/130/submissions/71 (71 is the new sid in {webform_submissions}).

lefnire’s picture

Status: Active » Closed (fixed)

Needed $form_values['op']='Submit':

$node=node_load($nid);
drupal_execute('webform_client_form_'.$nid, array('op'=>'Submit'), $node, array(), TRUE, FALSE);
manasseh-1’s picture

Would you use that after assigning values like the following?

$form_state['values'] = array(
'submitted[first_name]' => t('Marvin'),
'submitted[last_name]' => t('Winans'),
'submitted[title]' => t('PHP data'),
'submitted[message]' => t('THis is from the PHP file'),
'submitted[email]' => t('email@gmail.com'),
);
brunodbo’s picture

@manasseh:

Yep. I just did:

$form_state['values'] = array(
    'submitted' => array(
      'spandoeken' => '1',
      'affiches' => '2',
      'aantal_stickers' => '3',
      'aantal_folders' => '4',
      'aantal_campagnekranten' => '5',
    ),
    'op' => 'Submit',
  );
$node = node_load(15);
drupal_execute('webform_client_form_15', $form_state, $node, array(), TRUE, FALSE);
udig’s picture

Version: 5.x-2.1.3 » 6.x-2.6
Status: Closed (fixed) » Active

Hello,

Tried the above on D6. No submission is added (as if the activity didn't take place)
Are there any adjustments for D6 that I am missing?

Thanks.

quicksketch’s picture

Status: Active » Closed (fixed)

Are there any adjustments for D6 that I am missing?

That code snippet is for Drupal 6. You need to replace "15" with whatever your NID is.

drupal_execute('webform_client_form_15', $form_state, $node, array(), TRUE, FALSE);