double-submit-problem

Ajax form submit. form submitted twice

不想你离开。 提交于 2019-12-23 05:25:54
问题 I am working with cakePHP and in my view I have a form which has an ajax submit button. I rendered it using the cake helpers. <form method="post" class="form-class" id="form-id" name="form1" style="display: none"> *[content for the form]* <?php echo $ajax->submit('Ok', array( 'id'=> 'submit1', 'url'=> array('controller'=>'c','action'=>'action1'), 'complete'=> 'jsfunction()' )); echo $form->button('Submit',array('id'=>'cancel','value'=>'Cancel','onClick'=>'clickCancel()')); ?> </form> When I

Form submitted twice using submit() on keyup

允我心安 提交于 2019-12-21 19:55:07
问题 I had a jQuery / HTML code similar to this: <form action="/SomeAction" method="post"> <input id="my-textbox" type="text" placeholder="Write something and press enter to continue..." /> </form> <script type="text/javascript"> $(function() { $('#my-textbox').keyup(function(e) { var $textbox = $(this); if ($textbox.val().length > 0 && e.keyCode == 13) { $textbox.parent('form').submit(); } }); }); </script> The purpose was to automatically submit the form when the user pressed the "Enter" key. I

Prevent same action called twice as long as user is in current session

假如想象 提交于 2019-12-18 09:25:46
问题 I am using Struts2 framework, my problem is If user log-in into system and clicked some action lets say ACTION1 , flow will go to action class and executes some method, return appropriate result. He may visit some of the web pages, and again clicked ACTION1 . As long as he is in the same session, now the control should not go that particular method but the result should be same as previous results. How can we achieve this? 回答1: You can try a tokenSession interceptor. This interceptor builds

IE9 Double Form Submit Issue

这一生的挚爱 提交于 2019-12-18 03:25:50
问题 I am just wondering if anyone have some info or feedback about the situation I am in. Currently I am facing a "Double Form Submit" issue, where I click the "Submit" button once, and it submit the form twice. This only happens in IE9, but I have only tested against Safari, Chrome (Latest), FF (Ver 5/6), IE8, and IE9. Here is the code: <!DOCTYPE html> <html lang="en-us" dir="ltr"> <head> <meta charset="utf-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" > <title>IE9 test</title> <

IE9 Double Form Submit Issue

烈酒焚心 提交于 2019-12-18 03:25:39
问题 I am just wondering if anyone have some info or feedback about the situation I am in. Currently I am facing a "Double Form Submit" issue, where I click the "Submit" button once, and it submit the form twice. This only happens in IE9, but I have only tested against Safari, Chrome (Latest), FF (Ver 5/6), IE8, and IE9. Here is the code: <!DOCTYPE html> <html lang="en-us" dir="ltr"> <head> <meta charset="utf-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" > <title>IE9 test</title> <

How to avoid inserting two same records twice when double-clicking the submit button? [duplicate]

冷暖自知 提交于 2019-12-17 16:54:29
问题 This question already has answers here : How do you prevent a user from posting data multiple times on a website (7 answers) Closed 4 years ago . I have a popup window where there are two onclick methods as "Submit" and "Discard". When I click submit twice it insert two records that means duplicate record. How can I avoid this? 回答1: Preventing a double-submit is a common problem. Even though there are many solutions to it, since you've tagged it struts2, there are two ways provided out-of-the

In rails controllers, how to prevent double submit (when user double-clic submit button or hit enter twice)?

倾然丶 夕夏残阳落幕 提交于 2019-12-09 02:32:38
问题 Well, everything's in the title but I'll explain a little more :-) My rails app contain many forms (Ajaxified or not). To prevent users to submit twice or more some forms, I use Javascript. There's my scenario for a Ajaxified form : the user submit the form (clic or enter) the javascript disable the submit button the rails controller do things (like a Soap request or an insert in a DB) the rails controller update the page and enable the submit button if necessary (in case of errors) Now I

Form submitted twice using submit() on keyup

和自甴很熟 提交于 2019-12-04 12:43:23
I had a jQuery / HTML code similar to this: <form action="/SomeAction" method="post"> <input id="my-textbox" type="text" placeholder="Write something and press enter to continue..." /> </form> <script type="text/javascript"> $(function() { $('#my-textbox').keyup(function(e) { var $textbox = $(this); if ($textbox.val().length > 0 && e.keyCode == 13) { $textbox.parent('form').submit(); } }); }); </script> The purpose was to automatically submit the form when the user pressed the "Enter" key. I regularly use Firefox so everything was OK for me until I tested in Google Chrome and Internet Explorer

jQuery and default struts 2 submit buttons in one form

和自甴很熟 提交于 2019-12-02 13:32:02
问题 I have a problem with submitting form, which contains normal and jQuery submit button. This is code snippet of my JSP: <sj:head loadAtOnce="true"/> <s:form id="createModReadProjectForm" action="createProject" cssClass="internalForm" autocomplete="off"> <s:token/> <s:textfield name="collName" cssClass="textField internal" cssErrorClass="textFieldError internal" /> <div id="assignCollaborators"> </div> <s:url action="assignCollabolator" id="assignCollaboratorUrl"/> <sj:submit key="labels.button

Submit two HTML forms in JSP using single submit button with Ajax

久未见 提交于 2019-12-01 12:21:53
My page design is such that I have to use two forms that submit on single click and then saved to database and vice verse. I am using this on a JSP page with Struts2 Framework I have tries the Ajax solutions but they are not working for me. Here is my script( UPDATED ): $("#visitType").buttonset(); $("#patientCondition").buttonset(); $("input[type=submit], a, button").button().click(function(event) { event.preventDefault(); var inputs=$('#visitType,#patientCondition ').find(':input').not(this); var form_data={}; inputs.each(function(){ form_data[this.name]=$(this).val(); }); $.post(