请考虑以下形式:
<form action="/a" method="post">
<input name="x" type="text" onblur="myonblur(e)" />
<input name="y" type="text" />
<input name="submit" type="submit" value="Submit" />
</form>
Run Code Online (Sandbox Code Playgroud)
当焦点位于名为"x"的元素并且用户按下提交按钮时,onblur事件将触发,但不提交表单.如果我在表单中有onblur事件,有没有办法让提交按钮按预期工作?
我的asp.net webform中有一个提交按钮和后退按钮.按Enter键时我需要使用提交按钮,但它会转到后退按钮.
请帮忙...
我使用jquery的.submit()来拦截用户的提交事件,但是我发现了一个问题.
当用户单击提交按钮时,表单正常提交,但如果用户故意多次快速单击,则会多次提交,这将导致数据库中的重复数据.
这种问题的解决方案是什么?
更新:嗯,我看到一些建议说禁用提交按钮.这应该可以防止多次提交表单,但问题是我的页面中的表单元素没有刷新,如果我禁用它,用户将无法再提交它,禁用15秒可能会有效,但是这是解决这个问题的正确方法吗?
我正在尝试保存表单onkeyup操作.我是jquery的新手.
这可能吗.
我感谢任何帮助.
编辑1:保存表单意味着保存到服务器.有没有办法增加0.2秒的延迟.
我已经阻止了Enter(返回)键,实际上,它在Tab键中被转换了.因此,当在输入文本字段内按下时,它将充当Tab键.这很好,但我需要它在最后一个字段中按下时触发提交按钮,下面是Enter键变异的代码:
$('input').keydown(function(event) {
if(event.which == 13) {
event.preventDefault();
$(this).nextAll('input:first').focus();
}
});
Run Code Online (Sandbox Code Playgroud)
和形式码是一序列输入类型="文本"和一个按钮式="提交"在端[编辑]实际上代码是这其中,从拍摄的jquery:在特定部分输入到标签触发.但我不知道为什么今天昨天工作不起作用:
$(':text').keydown(function(e) {
if(e.keyCode == 13 && $(this).attr('type') != 'submit') {
e.preventDefault();
$(this).nextAll('input:first').focus();
}
});
Run Code Online (Sandbox Code Playgroud) 我正在为自己编写一个小网站,但在使用看似简单的一行代码时遇到了麻烦:
form action="send.php" method="post"
Run Code Online (Sandbox Code Playgroud)
此外,即使是一条简单的线form action="http://www.google.com">也行不通。这是我的代码:
<html>
<head>
<title>
AnonMail!
</title>
</head>
<body style="font-family:'Tahoma';>
<form action="send.php" method="post">
<label for="from">From: </label><input type="text" name="from" id="from"></input></br>
<label for="to">To: </label><input type="text" name="to" id="to"></input></br>
<label for="subj">Subject: </label><input type="text" name="subj" id="subj"></input></br>
<textarea rows=10 cols=100 name="message"></textarea></br>
<input type="submit" value="Send"/>
</form>
</body>
</html>
Run Code Online (Sandbox Code Playgroud) 我正在开发一个ASP.NET 4.0 Web Forms项目,经过大约5年的休息,我对提交行为感到困惑.
在按钮的单击事件中,我睡眠线程,以便我可以多次单击提交按钮.
据我所知,ASP.NET阻止了多次调用click事件.这是真的?
顺便说一句:我已经关闭了这个测试的javascript.
好.我已经看到这个问题已经超过10年未得到答复了..
如何在一键通话中提交和关闭弹出窗口.
建议如此运行.
function saveNClose()
{
document.form.submit();
self.close();
}
this doesn't work because the submit has a redirect, and the self.close is never reached.
Run Code Online (Sandbox Code Playgroud)
function closeLaterNSaveNow();
{
setTimeout("window.close()",5000);
document.form.submit();
}
same problem.. the close is never called because the script for the page is gone.
Run Code Online (Sandbox Code Playgroud)
function closeNowNSubmit()
{
self.close();
document.form.submit();
}
the window closes, but nothing gets saved. server doesn't even get notified of anything..
Run Code Online (Sandbox Code Playgroud)
<input class='btn btn-success' disabled='disabled' id='SubmitFinal' onclick='closeWindow()' type='submit' value='Finish'>
Well then there's no validation of the …Run Code Online (Sandbox Code Playgroud) 我希望仅当我选中“条款和条件”复选框时,才将条纹表格提交到服务器。
我的代码-
<script type="text/javascript">
function isAcceptedTermsAndConditions() {
var isCheckedTermsAndCondition = $('#termsAndCondition').is(":checked");
if (!isCheckedTermsAndCondition) {
$("#termsAndConditionMsg").show();
return false;
} else {
$("#termsAndConditionMsg").hide();
return true;
}
return false;
}
</script>
<div id ="userAgreement">
<div style="margin-left:20px;">
<input type="checkbox" id="termsAndCondition" onclick="isAcceptedTermsAndConditions()"> I have read and agree to the <a style="color: #0000FF" target="_blank" href="#">terms and conditions</a> .
</div>
<span id = "termsAndConditionMsg" class="btn btn-warning" style="margin-left:20px; display:none;padding:10px;margin-top:10px; ">
Please accept the terms and conditions.
</span>
</div>
<form action="/stripe/pay" method="POST" id="payment-form" onsubmit="return isAcceptedTermsAndConditions()">
<label>Card Number</label>
<input type="text" class="form-control" …Run Code Online (Sandbox Code Playgroud) 我有一个带有两个输入字段的登录表单:用户名和密码。
<form method="get" action="../Main/Index">
<p>
<input type="text" name="username" value="" placeholder="username" maxlength="30"></p>
<p>
<input type="password" name="password" value="" placeholder="password" maxlength="25"></p>
<p class="submit">
<input type="submit" name="commit" value="Enter">
</p>
</form>
Run Code Online (Sandbox Code Playgroud)
用户提交表单后,其用户名和密码将显示在浏览器的URL文本框中,如下所示:
http://localhost:53997/Main/Index?username=zm&password=123456789&commit=Enter
我不希望显示他的用户名和密码。
我怎样才能做到这一点?