Support » Plugin: Contact Form 7 » Contact Form 7 missing on_submit hook?

  • Resolved zaus


    In the additional_settings section of each form, you can use on_sent_ok, but is there a similar on_failure, or even just an after_submission?

    I’ve looked through the code, and in the scripts.js file there’s a section for “callbacks” using the onSentOk aspect of the response (refers to on_sent_okay from additional_settings, and another identical section for processing onSubmit (which was reported in v2.0.6 changelog). However, I can’t find any mention of onSubmit or on_submit in the rest of the code, and adding something like on_submit: alert('testing here'); does nothing.

    Once I “manually” attach the setting to the ajax response with the following, it works.


    add_filter( 'wpcf7_ajax_json_echo', array(&$this, 'ajax_results_append') );
    public function ajax_results_append($items, $results){
    	global $wpcf7_contact_form;
    	$items['onSubmit'] =     $wpcf7_contact_form->additional_setting( 'on_submit', false );
    	// send it back because it's a filter
    	return $items;

    Is this a bug, or am I missing something?

Viewing 2 replies - 1 through 2 (of 2 total)
  • = 3.3 =
    * New: Introduce new additional setting on_submit. It works like on_sent_ok and has one-line JavaScript code, but on_submit code is fired regardless of whether or not the mail has been sent successfully.

    nice, thanks for the update @nellone

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Contact Form 7 missing on_submit hook?’ is closed to new replies.