• Resolved mrpetreli

    (@mrpetreli)


    Hi Can you help

    We need to avoid people clicking submit more than once.

    Using something like

    <script type=”text/javascript”>

    function checkForm(form) // Submit button clicked
    {
    //
    // check form input values
    //

    form.myButton.disabled = true;
    form.myButton.value = “Please wait…”;
    return true;
    }

    function resetForm(form) // Reset button clicked
    {
    form.myButton.disabled = false;
    form.myButton.value = “Submit”;
    }

    </script>

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello,

    A easy solution would be insert a “HTML Content” field in the form with a piece of code similar to the following one as its content:

    <script>
    jQuery('.pbSubmit').click(function () {
    	jQuery(this).unbind('click');
    	setTimeout(function () {
    		jQuery('.pbSubmit').bind('click', function () {
    			jQuery(this).closest('form').submit();
    		});
    	}, 3000);
    });
    </script>

    Best regards.

    Thread Starter mrpetreli

    (@mrpetreli)

    Hi Thank you

    This doesn’t seem to work. I am still able to hit submit multiple times, which fires duplicate emails.

    Im looking to disable the button while its working or allow only 1 press then disable it (or grey it out)

    Plugin Author codepeople

    (@codepeople)

    Hello,

    I’ve checked the form inserted in your webpage (https://workshopcreations.ie/order-form/), and does not include a “HTML Content” field with the code I sent you previously.

    However, I recommend you a simple variation to my previous code:

    <script>
    fbuilderjQuery(document).one('showHideDepEvent', function(){
    fbuilderjQuery('.pbSubmit').click(function () {
    	fbuilderjQuery(this).unbind('click');
    	setTimeout(function () {
    		fbuilderjQuery('.pbSubmit').bind('click', function () {
    			fbuilderjQuery(this).closest('form').submit();
    		});
    	}, 3000);
    });
    });
    </script>

    Best regards.

    Thread Starter mrpetreli

    (@mrpetreli)

    Hi

    Sorry I was testing it on a test form.

    I have added it in now. Can you tell me what the code actually does.

    Thanks again

    Plugin Author codepeople

    (@codepeople)

    Hello,

    The code removes the onclick event from the submit button:

    fbuilderjQuery(this).unbind('click');

    and assigns to it the onclick event again 3 second later:

    setTimeout(function () {
        fbuilderjQuery('.pbSubmit').bind('click', function () {
            fbuilderjQuery(this).closest('form').submit();
        });
    }, 3000);

    you can increase the interval by replacing the 3000 milliseconds with a greater number, for example 5 seconds would be 5000

    By the way, there is an issue in the summary field in your form. In the summary fields should be entered only the fields’ names without a tag structure, please, replace the tag: <%fieldname149%> with the field name: fieldname149 in the properties of the summary field.

    Best regards.

    Thread Starter mrpetreli

    (@mrpetreli)

    Great thank you… and thanks for spotting that.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Submit Once’ is closed to new replies.