Support

Account

Home Forums Front-end Issues Confirm before submitting the form loads twice

Unread

Confirm before submitting the form loads twice

  • Hi all
    I have a front end form for submitting products.
    It is acf_form for creating a “new_post”, form = true

    I have added a jquery confirmation box which works but the problem is that it is showing up twice (first it shows up, you confirm, ajax loads and the box shows again) because of the ajax validating the form.
    I have used jquery confirm script:
    https://craftpip.github.io/jquery-confirm/

    here is the javascript code I am using for the confirm box:

    jQuery(document).ready(function($){
    	
    $('input[type="submit"]').confirm({
            title: 'Submit Product for review',
            content: 'Are you sure you want submit this?',
            type: 'green',
        buttons: {
            submit: {
                text: 'Publish',
                btnClass: 'btn-green',
                action: function(){
    				$( '#acf-form' ).submit();
                }
            },
            close: {
    			text: 'back',
    			function () {
            }
            }
        },
        onContentReady: function ($) {
            // bind to events
            var jc = this;
            this.$content.find('form').on('submit', function (e) {
                e.preventDefault();
                jc.$$submit.trigger('click'); 
            });
        }
    });
    
    });

    Is it possible to get this confirmation box to only load once?

    Thank you for your help.

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.