Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1324064

    hi there, i got a serious problems with the enfold contact form.
    check out this form https://www.metazeit.de/#formular and hit the submit button without entering anything.
    the page will get reloaded and stays on top so you never see the error or sucessful send message.

    how can i make the forms to scroll down to the responsive ajax message?
    i am using wordpress 5.8.1 and enfold 4.8.6.2 as a parent theme – no child is installed.

    accourding to other threads i might have to change /enfold/config-templatebuilder/avia-shortcodes/contact/contact.js
    but i don’t know what exactly.
    thanks for a fast reply
    thomas

    #1324212

    any news on this?

    #1324324

    Hi,
    Thank you for your patience, how about a popup modal of the form response, I based this script on this article.
    Try adding this code to the end of your functions.php file in Appearance ▸ Editor:

    function custom_script() { ?>
        <script>
    (function($){
    
        // Defining our jQuery plugin
    
        $.fn.paulund_modal_box = function(prop){
    
            // Default parameters
    
            var options = $.extend({
                height : "250",
                width : "500",
                title:"",
                description: "",
                top: "2%",
                left: "30%",
            },prop);
            var divbox = $('#result_ajax_response_1').eq(0).html();
                
            return this.click(function(e){
                add_block_page();
                add_popup_box();
                add_styles();
                
                $('.paulund_modal_box').fadeIn();
            });
            
             function add_styles(){         
                $('.paulund_modal_box').css({ 
                    'position':'absolute', 
                    'left':options.left,
                    'top':options.top,
                    'display':'none',
                    'height': options.height + 'px',
                    'width': options.width + 'px',
                    'border':'1px solid #fff',
                    'box-shadow': '0px 2px 7px #292929',
                    '-moz-box-shadow': '0px 2px 7px #292929',
                    '-webkit-box-shadow': '0px 2px 7px #292929',
                    'border-radius':'10px',
                    '-moz-border-radius':'10px',
                    '-webkit-border-radius':'10px',
                    'background': '#fff', 
                    'z-index':'50',
                });
                $('.paulund_modal_close').css({
                    'position':'relative',
                    'top':'-25px',
                    'left':'20px',
                    'float':'right',
                    'display':'block',
                    'height':'50px',
                    'width':'50px',
                    'background': 'url(https://img.icons8.com/ios/50/000000/cancel.png) no-repeat',
                    'background-color':'#fff',
                    'border-radius':'25px',
                    '-moz-border-radius':'25px',
                    '-webkit-border-radius':'25px'
                });
                            /*Block page overlay*/
                var pageHeight = $(document).height();
                var pageWidth = $(window).width();
    
                $('.paulund_block_page').css({
                    'position':'absolute',
                    'top':'0',
                    'left':'0',
                    'background-color':'rgba(0,0,0,0.6)',
                    'height':pageHeight,
                    'width':pageWidth,
                    'z-index':'10'
                });
                $('.paulund_inner_modal_box').css({
                    'background-color':'#fff',
                    'height':(options.height - 50) + 'px',
                    'width':(options.width - 50) + 'px',
                    'padding':'10px',
                    'margin':'15px',
                    'border-radius':'10px',
                    '-moz-border-radius':'10px',
                    '-webkit-border-radius':'10px'
                });
            }
            
             function add_block_page(){
                var block_page = $('<div class="paulund_block_page"></div>');
                            
                $(block_page).appendTo('body');
            }
                    
             function add_popup_box(){
                 var pop_up = $('<div class="paulund_modal_box"><a href="#" class="paulund_modal_close"></a><div class="paulund_inner_modal_box">' + divbox + '</div></div>');
                 $(pop_up).appendTo('.paulund_block_page');
                             
                 $('.paulund_modal_close').click(function(){
                    $(this).parent().fadeOut().remove();
                    $('.paulund_block_page').fadeOut().remove();                 
                 });
            }
    
            return this;
        };
    $(document).ready(function(){
        if($("#result_ajax_response_1").is(":visible")){
            $('#result_ajax_response_1').paulund_modal_box().trigger('click');
        }
     });
    
    })(jQuery);
    </script>
        <?php
    }
    add_action('wp_footer', 'custom_script');

    This is the result from my test
    2021-10-10_010.jpg

    Best regards,
    Mike

    #1324327

    hey mike, thanks i haven’t thought about a popup at all, but it does the job quite well.
    thanks and all my best
    thomas

    #1324395

    Hi,
    Glad we were able to help, if you have any further questions please create a new thread and we will gladly try to help you. Thank you for using Enfold.

    Best regards,
    Mike

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘make contact form scroll to sucess or error message after submission’ is closed to new replies.