Quantcast
Channel: WordPress.org Forums » [Visual Form Builder] Support
Viewing all articles
Browse latest Browse all 2775

vmallder on "[Plugin: Visual Form Builder] vfb_action_confirmation called twice when form is submitted"

$
0
0

Hello,

I have a question about the vfb_confirmation action hook. I have registered a function for the vfb_confirmation hook and it is being called twice each time a form is submitted. This is a problem for me because I am storing data from the form into my database inside my vfb_action_confirmation function, and I do not want to store the data twice.

The first time my vfb_action_confirmation function is called, it is because the Visual_Form_Builder::confirmation method is registered for the Wordpress “init” hook on line 146 of visual-form-builder.php. The second time my vfb_action_confirmation function is called is from line 25 of form-output.php.

At the beginning of my vfb_action_confirmation function, I have the following code:

`if ( !isset( $_REQUEST['vfb-submit'] ) )
return;`
But, that test fails in both cases, and does not prevent the body of the function from being excecuted twice each time the form is submitted.

How can I ensure that the body of my action function will be executed only once when a form is submitted? What other variables should I be checking at the beginning of my vfb_action_confirmation function to determine whether to execute the function or return?

Thank you

https://wordpress.org/plugins/visual-form-builder/


Viewing all articles
Browse latest Browse all 2775

Trending Articles