form-submit

Jquery Form.submit() on Chrome works but not in Firefox

梦想的初衷 提交于 2019-11-26 22:01:52
问题 I have the following function that collects data from a page, stuffs them all into the 'data' variable, appends it to a form then submits it. $(document).ready(function () { $('#content-tab .submit').click(function () { var data = {champion: window.selectedChampion, runes: runes, masteries: masteries, items: items, skillingOrders: skillingOrders, chapters: chapters, title: $('#guide_title').val()}; data = JSON.stringify(data); $("<form method='post'>").append($('<input type="hidden" name=

How to keep cascade dropdownlist selected items after form submit?

[亡魂溺海] 提交于 2019-11-26 21:07:49
When the page loads everything works fine. But when I submit the form my dropdownlists are loosing the previous selected items after page refresh. How can I modify my function to initialize the dropdownlists and keep the previous selected items (on both) if they exist. Here is my view with the javascript that initializes my dropdownlists: @model Models.Book @{ ViewBag.Title = "Index"; } @section scripts { <script type="text/javascript"> $(function() { $.getJSON("/Home/Books/List", function(data) { var items = "<option>--------------------</option>"; $.each(data, function(i, book) { items += "

Avoiding form resubmit in php when pressing f5

我的梦境 提交于 2019-11-26 20:47:03
I have the following code on my site (using php and smarty) to try and avoid a form resubmitting when I hit f5: if ($this->bln_added == false) { if (isset($_POST['submit'])) { $this->obj_site->obj_smarty->assign('title', $_POST['tas_heading']); $this->obj_site->obj_smarty->assign('desc', $_POST['tas_description']); } } else { $this->obj_site->obj_smarty->assign('title', ''); $this->obj_site->obj_smarty->assign('desc', ''); unset($_POST); } bln_added is false by default, but changes to true once the form is successfully submitted. The smarty variables title and desc are used in the template to

Does ASP.NET Web Forms prevent a double click submission?

可紊 提交于 2019-11-26 19:09:59
I'm working on an ASP.NET 4.0 Web Forms project, after a break of about 5 years, and I'm confused about the submit behaviour. In the click event of a button, I sleep the thread so that I can click the submit button multiple times. From what I can tell, ASP.NET is preventing the click event being called more than once. Is this true? BTW: I've turned off javascript for this test. Aristos " ASP.NET is preventing the click event being called more than once. Is this true? " No , actually what is happening to you is that your events are blocked by the lock of the session . ( What session is on asp

Disable form auto submit on button click

こ雲淡風輕ζ 提交于 2019-11-26 18:29:24
I have a HTML form where I use several buttons. The problem is that no matter which button I click, the form will get submitted even if the button is not of type "submit". e.g. Buttons like : <button>Click to do something</button> , result in form submission. It's quite painful to do an e.preventDefault() for each one of these buttons. I use jQuery and jQuery UI and the website is in HTML5. Is there a way to disable this automatic behavior? Buttons like <button>Click to do something</button> are submit buttons. Set type="button" to change that. type="submit" is the default (as specified by the

Submit POST data from controller to another website in Rails

戏子无情 提交于 2019-11-26 18:24:52
User submits a form with some basic data. The data is received and treated by an action in the controller and more information that needs to remain private is added. Then I need to send a post request to an external website with all of the combined data from the controller. What is the best way to do this? Vlad Zloteanu The simpliest way is using ruby core library: require "uri" require "net/http" params = {'box1' => 'Nothing is less important than which fork you use. Etiquette is the science of living. It embraces everything. It is ethics. It is honor. -Emily Post', 'button1' => 'Submit' } x

submitting multiple forms with AJAX

*爱你&永不变心* 提交于 2019-11-26 17:51:44
问题 I have a page which contains several forms. I want to add a single submission button that will allow all the forms to be saved at the same time, as illustrated below: <form id="form1" name="form1" action="someAction" method="post"> ....form fields </form> <form id="form2" name="form2" action="someOtherAction" method="post"> ....form fields </form> <form id="form2" name="form2" action="anotherAction" method="post"> ....form fields </form> <a href="somewhere.html" onclick="submitAll();">Submit

Pure Java/JSF implementation for double submit prevention

一世执手 提交于 2019-11-26 17:45:45
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, something like the Struts2 <s:token> . BalusC I am looking for generic mechanism to avoid form re

How send a form with Javascript when input name is “submit”?

放肆的年华 提交于 2019-11-26 16:40:32
Question: How can you send a form with Javascript if one form input has the name submit ? Background: I am redirecting the user to another page with a hidden HTML form. I cannot change name on the (hidden) inputs, since the other page is on another server and the inputs need to be exactly as they are. My HTML form looks like this: <form id="redirectForm" method="post" action="http://www.example.com/"> <input name="search" type="hidden" value="search for this" /> <input name="submit" type="hidden" value="search now" /> </form> I use the following javascript line to send the form automatically

How do I use an image as a submit button?

≡放荡痞女 提交于 2019-11-26 16:38:59
问题 Can someone help to change this to incorporate an image called BUTTON1.JPG instead of the standard submit button? <form id='formName' name='formName' onsubmit='redirect();return false;'> <div class="style7"> <input type='text' id='userInput' name='userInput' value=''> <input type='submit' name='submit' value='Submit'> </div> </form> 回答1: Use an image type input: <input type="image" src="/Button1.jpg" border="0" alt="Submit" /> The full HTML: <form id='formName' name='formName' onsubmit=