• Resolved ailaina123456

    (@ailaina123456)


    Hi,

    When updating/creating the profile page, the user is automatically redirected to the top of the page after the update/creation. When errors happen in the form, there is no error message at the top of the form to warn the user, the errors are only located below each field of the form which are not visible to the user when at the top of the page. The user will then leave the page thinking all is fine whereas her data has not been processed properly.

    How to show an error message at the top of the form in case any field is in error on the form after pressing the update/create button?

    Thanks a lot!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support andrewshu

    (@andrewshu)

    Hello @ailaina123456

    Unfortunately, this functionality does not exist in our plugin at this time.

    But you could scroll to the field with error. You could use this JS code:

    if( jQuery('.um-field-error').length > 0 ){
    		var el = jQuery('.um-field-error').first()
    		// jQuery('body').scrollTo( el );
    		jQuery([document.documentElement, document.body]).animate({
    			scrollTop: el.offset().top - 100
    		}, 0);
    }

    Regards.

    • This reply was modified 2 years ago by andrewshu.
    Thread Starter ailaina123456

    (@ailaina123456)

    Hi @andrewshu,

    Thanks, how can I add this code on the page other than with a code plugin? Is it possible to add it in the functions.php ?

    Thanks!

    Plugin Support andrewshu

    (@andrewshu)

    Hi @ailaina123456

    You could try to use this code in your functions.php:

    add_action( 'wp_footer', 'wp_um_custom_footer_script', 10000 );
    function wp_um_custom_footer_script(){
        ?>
        <script>
            if( jQuery('.um-field-error').length > 0 ){
                var el = jQuery('.um-field-error').first()
                // jQuery('body').scrollTo( el );
                jQuery([document.documentElement, document.body]).animate({
                    scrollTop: el.offset().top - 100
                }, 0);
            }
        </script>
        <?php
    }

    Regards.

    Thread Starter ailaina123456

    (@ailaina123456)

    Hi @andrewshu,

    It works perfectly and solves my issue.

    Thanks a lot ??

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Profile page global error message’ is closed to new replies.