Currently webform is used to build a contact form. The contact form also need to send the results of the submitted information to Constant Contact. I know I need to use hook_webform_submission_insert but I'm not sure where to put this function to achieve the result I want. I currently have the function in template.php but I don't think the function is being executed.

Thanks for any words of wisdom.

Comments

ravervx’s picture

Title: How to us hook_webform_submission_insert to send data to Constant Contact? » How to use hook_webform_submission_insert to send data to Constant Contact?
quicksketch’s picture

Hooks may only be executed by modules, and so you'd need to make a custom module to put your implementation of hook_webform_submission_insert() into. I'd probably recommend using presave rather than insert though, in case the user saves a draft or later edits their submission.

ravervx’s picture

Thanks for the pointer. I'm not sure how to make a module to process a webform form submission. Do I make a module with the hook_webform_submission_insert() or presave() function and that is it? When the form submits, it will automatically call the module and the hook functions?

quicksketch’s picture

Status: Active » Fixed

Yes, hooks work just by naming your functions [module_name]_[hook_name]. I don't provide support on custom coding in the issue queues. I'd recommend the Pro Drupal Development book or the Lullabot Module Development DVD for learning how to write modules. I'm marking this fixed because it's outside the scope of the Webform issue queue.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

d8v15’s picture

Issue summary: View changes

Similar issue. But what is needed is to add javascript to the page after/on insert that calls an api function on another server.

What hook to use and how to add that javascript ot the page through the hook. It will need access to the form data.