Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #460982

    When a form is successfully submitted, the success message shows at the top of the page – all good. The problem is that you can’t see the message unless you know to scroll to the top of the page. When the submit button is clicked for a correctly completed form, I would like the page to auto auto scroll so the message can be seen. How is this accomplished?

    #461090

    Hi,

    Can you post the link to your website please? the form should disappear once submitted.

    Regards,
    Josue

    #461578

    Yes, the form disappears, but the success message is way up top it’s not seen without scrolling up.

    #461581
    This reply has been marked as private.
    #461656

    Hi,

    Try adding this at the very end of your theme / child theme functions.php file:

    function add_custom_script(){
    ?>
    <script>
    (function($){
        $(window).load(function() {
        	$(".avia_ajax_form input.button").on('click', function(){ $("a#scroll-top-link").trigger('click'); });
        });
    })(jQuery);
    </script>
    <?php
    }
    add_action('wp_footer', 'add_custom_script');

    Regards,
    Josue

    #464687

    It does fix the scrolling issue when the form is successfully completed. But, it scrolls up to the top every single time the submit button is selected, which is a little confusing/annoying to a user. (I.e when one field is incorrect, it scrolls by it all the way to the top. The user would have no idea why that happened.)

    #465223

    Hi!

    I have an idea that could do the trick, can you please create us a WordPress administrator account? post it here as a private reply.

    Regards,
    Josue

    #466588

    OK.

    #467199

    Check it now.

    Regards,
    Josue

    #467211

    That works! Thanks. What is the code and/or other change? I don’t want to loose it or break the site when the theme or anything else is upgraded. Plus, I would like to have other forms look and function the same for consistency.

    #467228

    There’s a Code Block before the form if you edit that Page, you can copy that to other forms to replicate the effect, other than that i modified the code in functions.php.

    Also, i’d suggest you transition a Child Theme to store those custom functions you have in Enfold functions.php, they will be lost if you update the theme.

    Cheers!
    Josue

    #469821

    Thanks, resolved. Can you refer me to someone who can set up the child theme for me, and move the customize functions to it?

    #469870

    Hello!

    It’s not really a hard task but if you want someone to do it for you, you can request a customisation quote from a third-party provider here.

    Regards,
    Josue

    #469875

    Thanks.

Viewing 14 posts - 1 through 14 (of 14 total)

The topic ‘Form success message isn't seen unless you scroll’ is closed to new replies.