Custom Fields
Re-Envisioned
Support MB Frontend Submission Redirect to form after failed validation

  • Creator
    Topic
  • #33038
    Steffen Larsen
    Participant

    How come the redirect not working when there is failed validation? Does it only work with succesful submits?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Author
    Replies
  • #33050
    Long Nguyen
    Moderator

    Hi Steffen,

    A little bit tricky, you can add the redirect function when validating with the hook rwmb_frontend_validate. Like this

    add_filter( 'rwmb_frontend_validate', function( $validate, $config ) {
        if ( empty( $_POST['field_id'] ) ) {
            wp_redirect( 'https://facebook.com' );
            die;
        }
        return $validate;
    }, 10, 2 );
    #33136
    Steffen Larsen
    Participant

    But then the validate message doesn't show?

    I just wanna redirect to the form like this (it stays on the same site, but scrolls to the form) https://www.sikkerfangst.dk/produkt/en-ordentlig-fiskestang#auktionsbud

    Your example works, but then the message doesn't show.

    #33147
    Long Nguyen
    Moderator

    Hi,

    Currently, it is not possible to redirect to a URL if the validation is not passed. I will inform the development team to explore the possibility.

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.