form-submit

AngularJS: Call the ng-submit event outside the form

拈花ヽ惹草 提交于 2019-12-17 18:27:52
问题 I'm a fish in AngularJS and I have this scenario. <form> <input type="text"> </form> <button type="submit">submit</button> In normal ways AngularJS provides the ng-submit directive to work as an attribute in the form but I need to call it outside. So, someone has experienced the same problem? If yes, what you did? 回答1: Please, surround your code with a ng-controller, and use ng-click on buttons out of scope of <form>. I make a sample on jsfiddle for you... try it: http://jsfiddle.net/xKkvj/2/

Duplicate form submission in Spring [closed]

孤人 提交于 2019-12-17 17:32:01
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . What's the best way of avoiding duplicate form submission in Spring. Does this framework provide any special feature to handle this problem (for example as the Synchronizer Token in Struts)? 回答1: There are different ways to avoid double submits, which can be combined: Use JavaScript to disable the button a few

Javascript Submit does not include Submit Button Value

自作多情 提交于 2019-12-17 10:56:21
问题 Ok, this is less of a question than it is just for my information (because I can think of about 4 different work arounds that will make it work. But I have a form (nothing too special) but the submit button has a specific value associated with it. <input type='submit' name='submitDocUpdate' value='Save'/> And when the form gets submitted I check for that name. if(isset($_POST['submitDocUpdate'])){ //do stuff However, there is one time when I'm trying to submit the form via Javascript, rather

JavaScript form submit WITH a field called submit

浪子不回头ぞ 提交于 2019-12-17 10:05:51
问题 I was wondering if there is any method (using JS or otherwise) to autosubmit a form with a field with name and id as 'submit'. Essentially, my entire HTML code looks like this: <html> <body onload=myForm.submit()> <form id="myForm" name="myForm" action="http://example.com/examplePage.do" method="POST"> <input type=hidden name="val1" id="val1" value="some_Value"/> <input type=hidden name="val2" id="val2" value="another_Value"/> <input type=hidden name="val3" id="val3" value="yet_another_Value"

Submit POST data from controller to another website in Rails

谁说胖子不能爱 提交于 2019-12-17 03:53:08
问题 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? 回答1: 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

Disable form auto submit on button click

≯℡__Kan透↙ 提交于 2019-12-17 02:59:29
问题 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? 回答1: Buttons like <button>Click to do something<

jQuery - add additional parameters on submit (NOT ajax)

北战南征 提交于 2019-12-17 02:54:14
问题 Using jQuery's 'submit' - is there a way to pass additional parameters to a form? I am NOT looking to do this with Ajax - this is normal, refresh-typical form submission. $('#submit').click(function () { $('#event').submit(function () { data: { form['attendees'] = $('#attendance').sortable('toArray').toString(); }); }); 回答1: This one did it for me: var input = $("<input>") .attr("type", "hidden") .attr("name", "mydata").val("bla"); $('#form1').append(input); is based on the Daff's answer, but

cffile alternative, I need to upload without form submit

谁都会走 提交于 2019-12-14 03:59:29
问题 So I want to upload a file to the server using ajax, so the form is not submitted. Cffile requres the filefield attribute, but as there is no form object passed to coldfusion that doesn't work. I can store the value entered by the user as a variable in javascript, and pass that variable to cf. How can I use this variable to upload my file? Thanks. EDIT Solved by submitting to iframe. 回答1: You can use the cffileupload tag (embeds a flash widget for uploading) , or take advantage of

How can i click submit button

你说的曾经没有我的故事 提交于 2019-12-14 03:34:57
问题 How can i click on submit button on the given html <span class="sbt-btn-wrap relative"> <input class="submit icon" type="submit" onclick="submitmnLogin($(this), 'testPrepLogin');trackGaEvent('Content Hub Home','Login Popup','Login Button');"> I have tried driver.findElement(By.className("sbt-btn-wrap relative")).click(); and driver.findElement(By.className("submit icon")).click(); but it is not working. 回答1: When you have two class names with space separating them, then you cannot use By

jQuery .submit() replacement with angular?

余生长醉 提交于 2019-12-14 03:13:38
问题 Is there angular event trigger function, like we have with jQuery for following action? $('.link').click(function () { $('form').submit(); // this will submit form }); Please note, that this is not onSubmit function which is mostly <form ng-submit="submit()"/> 回答1: You can use ng-click to call a function in your controller to execute form submission. $('form').submit() using jQuery or document.getElementById('someForm').submit() using JavaScript 来源: https://stackoverflow.com/questions