Welcome Guest, Not a member yet? Register   Sign In
Looking for security / performance experts
#8

I tried a bunch of different solutions for form double submissions - this jquery solution was the best i found - requires that you load the jquery library

Code:
      <script>
           jQuery.fn.preventDoubleSubmission = function () {
               $(this).on('submit', function (e) {
                   var $form = $(this);

                   if ($form.data('submitted') === true) {
                       e.preventDefault();
                   } else {
                       $form.data('submitted', true);
                   }
               });

               return this;
           };

           $('form').preventDoubleSubmission();

          $('form :submit').click(function () {
               $(this).prop("disabled", true).closest('form').append($('<input/>', {
                   type: 'hidden',
                   name: this.name,
                   value: this.value
               })).submit();
           });

</script>


Messages In This Thread
RE: Looking for security / performance experts - by cartalot - 11-28-2016, 08:45 PM



Theme © iAndrew 2016 - Forum software by © MyBB