how to prevent double submissions
Last Post 04-10-2013 04:59 AM by Ryan Bakerink. 3 Replies.
AddThis - Bookmarking and Sharing Button
Author Messages
Mark BuelsingUser is Offline
river guide
river guide
Posts:241
Avatar

--
02-12-2013 05:07 PM
    somehow my users are able to double submit the df form, presumably by double-clicking the submit button. how can i prevent this?
    Ryan BakerinkUser is Offline
    river guide
    river guide
    Posts:1900
    Avatar

    --
    02-13-2013 04:47 AM
    Hello Whetstone,

    I would recommend creating a custom HTML Button like outlined in this blog post:
    http://www.datasprings.com/news/blo...mit-button

    You can then embed JavaScript to disable the submit button once clicked.

    document.getElementById('HTML_Button_ID').disabled = true;
    // Dynamic Form submission code after

    This code will be in the OnClick event of your HTML button.

    Please let me know if this helps.

    Thanks,

    Ryan
    Mark BuelsingUser is Offline
    river guide
    river guide
    Posts:241
    Avatar

    --
    04-09-2013 04:17 PM
    Thanks Ryan, I was able to follow your directions to make a button that does submit the form. I have two additional questions.

    1. This is the code that makes my button:

    input type="button" value="Submit Form" onclick="__doPostBack('dnn$ctr1741$DynamicForms$imgSave','')"

    where do I put the code that you suggest to disable the button?
    document.getElementById('HTML_Button_ID').disabled = true;

    This is what I tried, but it didn't work.

    input type="button" value="Submit Form" onclick="__doPostBack('dnn$ctr1741$DynamicForms$imgSave','');document.getElementById('HTML_Button_ID').disabled = true; "

    What should this have been? I'm pretty new to this aspect of forms.


    2. When this is working, it will disable the "submit form" button after the button is clicked, right? Well my form has some field validation turned on. What happens if a person clicks the button, the validation fails, they make their correction and attempt to click the button again. Will it be clickable? Or will it be disabled?

    This technique will not work for me if the answer is the button will still be disabled because of the first click.

    Thanks a lot Ryan.
    Ryan BakerinkUser is Offline
    river guide
    river guide
    Posts:1900
    Avatar

    --
    04-10-2013 04:59 AM
    Hello Whetstone,

    I would recommend building a Custom Submit Button using a Text/HTML question and initially hiding the built in Submit button. Use this blog to catch you up to speed with this concept:
    http://www.datasprings.com/news/blo...mit-button

    You'll then inject your Disabling Button JavaScript before the Dynamic Form Submit Processing procedure is called.

    For instance, this will be similar to the OnClick event for your custom HTML Button(Text/HTML field with HTML):

    onClick=
    "
    document.getElementById('HTML_Button_ID').disabled = true; __doPostBack('dnn$ctr2536$DynamicForms$lnkSave','')
    "
    Now the issue appears to be because you're using an Image Button for your Submit Button. If you must continue using an Image Submit Button.

    I would recommend using an anchor tag wrapped around an img linked to the image you're using. So change your out of the box Dynamic Form submit button to an HTML Button. Save and Update Settings. Now copy the JavaScript from the OnClick event of the actual Submit Button of the Dynamic Form. Paste this into your OnClick event of the anchor tag in your custom HTML button

    
    <a href="#" onClick="document.getElementById(&#39;HTML_Button_ID&#39;).disabled = true;  __doPostBack(&#39;dnn$ctr2536$DynamicForms$lnkSave&#39;,&#39;&#39;) return false;"><img src="/source/to/your/image.png"/></a>
     


    I hope this helps.

    Also,anytime that a Postback occurs(what happens when the submit button is clicked), after the page reloads, the JavaScript to disable the button is lost, which re-enables the button.

    Thanks,

    Ryan


    ---
  • film izle
  • 720 izle
  • film
  • sinema izle
  • film makinesi
  • T�rk�e dublaj film
  • film izle
  • film izle
  • baglan film izle
  • sinema izle
  • 1080 film izle
  • film mercegi