• Resolved plgupa

    (@plgupa)


    Hi,

    I have created a form. On submission of the form I am doing some database operation in action function- ‘forminator_custom_form_submit_before_set_fields’. Based on the result I want to display inline message in the form frontend. Is there any way?

    Thanks.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Support Nithin – WPMU DEV Support

    (@wpmudevsupport11)

    Hi @plgupa,

    I’m checking with our developer to see what would be the best approach in such use case and will get back once we get further update asap.

    Best Regards,

    Nithin

    Plugin Support Nithin – WPMU DEV Support

    (@wpmudevsupport11)

    Hi @plgupa,

    You can use these two hooks for this:

    forminator_form_submit_response
    forminator_form_ajax_submit_response

    The above two filters can be used to change the in line message. The 1st hook is when page reload submission is enabled and the 2nd is for Ajax Submission.

    For example, the following code changes the response URL, you could use the following example as a reference to change the response message:

    add_filter( 'forminator_form_submit_response', 'wpmudev_formi_response_data', 20, 2 );
    add_filter( 'forminator_form_ajax_submit_response', 'wpmudev_formi_response_data', 20, 2 );
    function wpmudev_formi_response_data( $response, $form_id ){
    	if( $form_id != 361 ){
    		return $response;
    	}
    	$response['url'] = 'http://mylocal.local/'; 
    
    	return $response;
    }

    Please note that the above is more of an example. The 361 in the above code is the form id where the code is supposed to work.

    I hope this helps in moving forward.

    Kind Regards,

    Nithin

    Thread Starter plgupa

    (@plgupa)

    Hi,

    Thanks for the reply. This filter can change the response message.

    But I want to change response message based on some database processing done on form data. In this filter I am not getting form data. Is there any way to get it?

    Note:- As mentioned earlier I am using an action to perform database processing – ‘forminator_custom_form_submit_before_set_fields’

    Thanks

    Plugin Support Zafer – WPMU DEV Support

    (@wpmudevsupport15)

    Hi @plgupa,

    I hope you are doing well today!

    You can check the following actions that you can use after form submission;

    forminator_form_before_handle_submit
    forminator_form_after_handle_submit
    forminator_form_before_save_entry
    forminator_form_after_save_entry

    Kind regards,
    Zafer

    Thread Starter plgupa

    (@plgupa)

    Hi,

    To anyone looking for solution. I solved my problem using below method:-

    1. Save the result of form data processing done in action – ‘forminator_custom_form_submit_before_set_fields’ into database table.
    2. Now, in action – ‘forminator_form_after_save_entry’ edit the inline message based on saved database entry.
    Plugin Support Nebu John – WPMU DEV Support

    (@wpmudevsupport14)

    Hi @plgupa,

    Glad to know you have managed to solve the problem. Please feel free to open a new ticket if you need any other help, we are happy to assist.

    Kind Regards,
    Nebu John

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Custom inline message based on PHP code’ is closed to new replies.