onsubmit

How can I prevent this jQuery function from being executed on every page load?

坚强是说给别人听的谎言 提交于 2019-12-04 02:06:33
问题 I believe I have a solution to my problem, but I want to be sure. This is what I have: <html>... <body>... <script type="text/javascript" src="../JS/jquery.js"></script> <script type="text/javascript" src="../JS/respond.min.js"></script> <script type="text/javascript" src="../JS/jquery.min.js"></script> <script type="text/javascript" src="../JS/validate.js"></script> <script type="text/javascript" src="../JS/jQueryCalls.js"></script> ... <form name="login-form" class="login-form" method="post

Form onsubmit versus submit button onclick

你。 提交于 2019-12-03 17:58:11
问题 UPDATE From @BrendanEich ‏ @mplungjan onclick of submit just falls out of that being a button; form onsubmit is clearly better. Which would be the reasons to ever use the onclick of a submit button to determine whether or not the form should be submitted? I believe strongly that to execute something before submit and cancel the submit in case of error, the form's onsubmit event is the obvious place to put it If you use the onclick of a submit button and later decide to use type="image" the

Submitting a form with JQuery Ajax results in multiple requests (and submissions)

爱⌒轻易说出口 提交于 2019-12-03 08:53:22
I have run into an issue with JQuery form submissions and have found no answers anywhere . If someone could shed some light on this, it would be highly appreciated. The issue: The first time I submit the form, it works fine. But if I submit the same form a second time, it sends 2 requests, 3 requests the third time, and so forth. Script: function postInvokeFunctionForm(functionId){ var formId = "#"+functionId+"-form"; var formUrl = "invokeFunction.html?functionId="+functionId $(formId).submit( function(){ $.ajax({ type: 'POST', url: formUrl, data: $(formId).serialize(), success: function (data

Why is my jQuery/Javascript function not being called correctly with onsubmit?

心不动则不痛 提交于 2019-12-02 17:50:58
问题 I have this jQuery function that is using another jQuery library called html5csv.js (which explains some of the CSV stuff you will see) Here is it: function validateNewQuiz() { CSV.begin("#upload_csv").go(function(e,D) { if (e) { return console.log(e); alert("Sorry, an error occured"); } var s = ""; for (var i = 0; i <= D.rows.length - 1; i++) { s +=D.rows[i].join(','); s += "\n"; } var fullString = s; if(/^(([^,]+,){4}[^,]+\n){3}$/.test(fullString)) { return true; } else { return false; } })

Javascript not working on submit

女生的网名这么多〃 提交于 2019-12-02 13:43:01
In my HTML file, I have the following script: <script language = "javascript"> function validation(){ var x = document.forms["form"]["fieldx"].value; var y = document.forms["form"]["fieldy"].value; var act = document.forms["form"]["action"].value; if(x == null && y == null && act == "delete"){ var z = confirm("Fields have no input. Proceed at your own risk"); if(z==true) return true; else return false; } } </script> And the form: <form name="form" onsubmit="return validation()" action="cgi-bin/process.cgi" method="GET"> <input type="text" name="fieldx" /> <input type="text" name="fieldy" />

Only want a link to be able to be clicked once

偶尔善良 提交于 2019-12-02 10:00:50
I have a link that opens a new page and I was wondering if there was a way that would make the link only click-able once so the form cannot be submitted numerous times. <div id="addSection"><a class="addSection" onclick="javascript:writeBookmark(this); var newwin = window.open('<c:url value="/URL_WINDOW"/>', 'additional', 'width=400,height=280,toolbar=no,,menubar=no,scrollbars=yes,resizeable=no'); newwin.focus(); return null;">       Add sub I have JavaScript to do this with buttons but not sure how to do it when I am not dealing with buttons. First, I would move your click handler so that it

safari/chrome onsubmit=“location.reload(true)” not working

 ̄綄美尐妖づ 提交于 2019-12-01 17:25:34
A form on my website is not functioning correctly in Safari/Chrome. When a user submits the form, it opens up a new tab, but I want the original page (page with the form on it) to reload. It works in IE, Opera, and Firefox. The Code: <form action="/search.php" method="post" onsubmit="location.reload(true)" target="_blank" name="myform"> I tried other javascript functions like: window.location.reload(); document.location.reload(); window.location.replace('http://www.websiteurl.com'); window.location.href='http://www.websiteurl.com'; And other variations of these. I thought maybe it was the

safari/chrome onsubmit=“location.reload(true)” not working

空扰寡人 提交于 2019-12-01 17:09:53
问题 A form on my website is not functioning correctly in Safari/Chrome. When a user submits the form, it opens up a new tab, but I want the original page (page with the form on it) to reload. It works in IE, Opera, and Firefox. The Code: <form action="/search.php" method="post" onsubmit="location.reload(true)" target="_blank" name="myform"> I tried other javascript functions like: window.location.reload(); document.location.reload(); window.location.replace('http://www.websiteurl.com'); window

How can I prevent this jQuery function from being executed on every page load?

我只是一个虾纸丫 提交于 2019-12-01 13:08:49
I believe I have a solution to my problem, but I want to be sure. This is what I have: <html>... <body>... <script type="text/javascript" src="../JS/jquery.js"></script> <script type="text/javascript" src="../JS/respond.min.js"></script> <script type="text/javascript" src="../JS/jquery.min.js"></script> <script type="text/javascript" src="../JS/validate.js"></script> <script type="text/javascript" src="../JS/jQueryCalls.js"></script> ... <form name="login-form" class="login-form" method="post" onSubmit="login()"> <div class="header"> <h1>Sign In</h1> </div> <div class="content"> <input type=

onsubmit refresh html form

﹥>﹥吖頭↗ 提交于 2019-12-01 03:25:05
I'm trying to use Javascript to submit the form's data. Here's the html. <form onsubmit="post();"> //input fields here </form> Here's the Javascript for the post() function. var post = function() { alert('the form was submitted'); return false; } My issue is that the Javascript runs but the form still processes and refreshes the page.. I put the return false; code in hoping it would stop the form from refreshing. D. Strout You will have to put the return false part after the post() function in the onsubmit handler, like so: <form onsubmit="post();return false;"> //input fields here </form>