Support » Plugin: Torro Forms » Hook for additional checks before saving

  • Hi,

    I am trying to check if the mail already exists in the database for this form. If so, the form shouldn’t be saved and an error should be thrown.

    At the moment I am using the hook ‘torro_response_saved’ for getting the form data in order to insert the user in an external newsletter database (if checkbox is checked). Is there any hook before the data gets saved? How can I throw an error and display it above the form?



Viewing 1 replies (of 1 total)
  • Plugin Author Sven Wagener


    Hi Marc,

    yes there is an actionhook for that. It is named ‘torro_element_type_validate_input’;

    Just take a look here:

    Code example for additional check:

    function my_element_check( $input, $element ) {
        if( $element->id === YOURELEMENT_ID ) // Replace YOURELEMENT_ID
            if( ! your_db_emailcheck( $input ) ){
                return new new Torro_Error( 'email_exists_in_db', __( 'Your Email already exists in the database.', 'torro-forms' ) );
            return $input;
        return $input;
    add_filter( 'torro_element_type_validate_input', 'my_element_check' );

    I hope that helps you!



Viewing 1 replies (of 1 total)
  • The topic ‘Hook for additional checks before saving’ is closed to new replies.