Support

Account

Home Forums Front-end Issues Save the form and go to the next screen

Unread

Save the form and go to the next screen

  • Hi there,

    I use acf_form in front to create a post when we validate/update the form. Also, the form is divided into several horizontal slides. I would like that when you click on the save button, it saves and goes to the next slide.

    My function acf_form :

    function getACFForm($current_user, $acf_group): array
    {
        $post_title = $current_user->user_email;
        $user_info_post = get_page_by_title($post_title, '', 'user-info');
    
        return [
            $new_post = 'new_post' => [
                'post_type' => 'user-info',
                'post_status' => 'publish',
                'post_title' => $post_title,
            ],
            'post_id' => isset($user_info_post->ID) ? $user_info_post->ID : 'new_post',
            'field_groups' => [$acf_group],
           <strong> 'html_submit_button' => '<input type="submit" class="acf-button button button-primary button-large validate" value="√Čtape suivante" />',</strong>
            'updated_message' => " Merci d'avoir rempli le formulaire.",
        ];
    }

    my js for slide next :

      function moveLeft() {
                                        $('#slider ul').animate({
                                            left: +slideWidth
                                        }, 200, function() {
                                            $('#slider ul li:last-child').prependTo('#slider ul');
                                            $('#slider ul').css('left', '');
                                        });
                                    };
    $('a.control_next').click(function() {
                                        moveRight();
                                    }); 

    If I replace “a.control_next” with the class of the form’s submit button. It goes to the next slide and at the same time it refreshes the page and it goes back to the slide on which we validated the form..

    Thank you all for your ideas

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.