Hi,

I've tried searching for a solution but nothing immediately pops out.

History : Newbie with Drupal and the whole html/forms thing. Experienced c++/SQL programmer.

I create a webform, all seems fine. I hit the submit button and the data is stored in a proprietary webform table in my schema.

Is there any way I can intercept this save and ask the data to be saved elsewhere ?

Thanks
keith

Comments

quicksketch’s picture

You can inject any PHP code you'd like into the Additional submit box under the Advanced settings for a webform. If looking for what variables are available to you, paste this into the box and it'll tell you what variables you have available:

drupal_set_message('<pre>'. print_r(get_defined_vars(), true) .'</pre>');
Keith Hurst’s picture

Thanks for this,

I put the code in the Additional Processing box and the following appears...

[form_values] => Array
(
[submitted] => Array
(
[1200569718] => name - Full
[1200569749] => name - short
[1200569776] => Array
(
[month] => 2
[day] => 17
[year] => 2008
)

)

[details] => Array
(
[email_subject] => default
[email_from_name] => default
[email_from_address] => default
[nid] => 9
)

[op] => Submit
[submitbutton] => Submit
[form_token] => aafc1e23bb20876404d5b73aa7183656
[form_id] => webform_client_form_9
[submitted_tree] => Array
(
[pokernights_fullname] => name - Full

Plus some other stuff.

I'm interested in the last line shown [pokernights_fullname]. How can I access this directly ? I tried...

drupal_set_message('<pre>'. print_r($form_values[ submitted_tree ][ pokernights_fullname ] ?
, true) .'</pre>');

But it just bombs out.

Thanks
Keith

Keith Hurst’s picture

Got it - Thanks again.

Keith

quicksketch’s picture

Status: Active » Closed (fixed)

Great!

guislutavo’s picture

This doesnt work in my site... there is simply nothing in the screen when I fill the form and sumbmit it. I've written this in the Additional Processing box:

 print $form_values['submitted_tree']['sambe'];
print $form_values['submitted']['sambe'];
$form_values['submitted_tree']['sambe'] = '10000';
$form_values['submitted']['sambe'] = '10000';

Then it shows the value in the 'submitted_tree' array and I can modify it. Also I can change the values in the 'submitted' array and send the confirmation e-mail with these new values, but I cannot show the content of the 'submitted' array, and I cannot change any submit value in the Data base. I've been searching for some help in this forum since a month ago and i've not found something... Someone could help me?

kriskhaira’s picture

When using submitted, you have to use the component ID which is a number you can get from the end of the URL when you edit the component.

kriskhaira’s picture

When using submitted, you have to use the component ID which is a number you can get from the end of the URL when you edit the component.