double-submit-prevention

Pure Java/JSF implementation for double submit prevention

冷暖自知 提交于 2019-11-26 06:06:59
问题 We\'re using JSF 2.0 on WebSphere v8.5 with several component libraries PrimeFaces 4.0, Tomahawk 2.0, RichFaces, etc. I am looking for generic mechanism to avoid form re-submission when the page is refreshed, or when the submit button is clicked once again. I have many applications with different scenarios. For now I have considered disabling the button with a piece of JavaScript in onclick attribute, but this is not satisfying. I\'m looking for a pure Java implementation for this purpose,

Prevent double submission of forms in jQuery

妖精的绣舞 提交于 2019-11-26 01:23:32
问题 I have a form that takes a little while for the server to process. I need to ensure that the user waits and does not attempt to resubmit the form by clicking the button again. I tried using the following jQuery code: <script type=\"text/javascript\"> $(document).ready(function() { $(\"form#my_form\").submit(function() { $(\'input\').attr(\'disabled\', \'disabled\'); $(\'a\').attr(\'disabled\', \'disabled\'); return true; }); }); </script> When I try this in Firefox everything gets disabled