Support » Plugin: Forminator - Contact Form, Payment Form & Custom Form Builder » cancel my form using function hook

  • Resolved Byron Hasegawa


    i want to cancel my form using function hooks

    add_action( 'forminator_custom_form_submit_before_set_fields', function( $entry, $form_id, $field_data_array ){		
      $phone = $_POST['phone-1'];
      global $wpdb;
      $results = $wpdb->get_results('select * from <code>wp_users</code> where user_login = "'.$phone.'"');
      if ( $results ) {
        var_dump("same number exits");
        return false; // cancel the form
      } else {
    },20 , 3 );
Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support Prathamesh – WPMU DEV Support


    Hello @byron222,

    The stated code would rub a database query before saving the form to check if the same phone number exists.

    Can you elaborate a bit more on what do you mean by cancelling the form so we could help you with the further?

    I am looking forward to hearing from you on it.

    Prathamesh Palve

    Thread Starter Byron Hasegawa


    i want to cancel the form to submit and stop to set a data in the database and also to send a notification email to the Site Administrator and the customer.

    Thread Starter Byron Hasegawa


    I only want to return false and stop to submit the form.

    Please, I urgently need this.

    thank you.

    Thread Starter Byron Hasegawa


    please, i need to know if this is possible or not.

    Plugin Support Pawel – WPMU DEV Support


    Hello @byron222

    I trust you’re doing well!

    I apologize we have missed your last reply. If you mean by canceling the form is to prevent visitors from submitting it, it can be done from the Frominatoir settings.

    Please edit the form and open Behaviour tab, scroll to Lifespan and set the form to expire after a date of your choice or limit it to a certain number of submissions that can be made.

    In order for the form not to submit information to the database, please go to the Settings tab, and enable options that says Disable store submissions in my database.

    If you still need assistance with your query please feel free to re-open this ticket or open a new one.

    Kind regards,

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘cancel my form using function hook’ is closed to new replies.