如何暂停表单提交,最后一次验证,在最后和之后释放/触发/继续提交
How to pause form submit, for 1 last validation, at the very end and after that release/trigger/continue the submission?
我有一个page1.php和我有一个fly.php。php是一个简单的(常规的)表单页面,当用户提交表单时,人们在这里放置信息。
- 通过ajax加载captcha模板并要求在飞行中验证(直到这里是好的)。在onFly验证之后,我想允许这个。submit()继续
问题:此验证码的How can i after .submit() pause for validatio
n验证成功后,恢复表单提交(这是暂停)?
的例子:
Part 1: page1.php
$(document).ready(function()
{
$('.callmeback').submit(function()
{
$.ajax({
type : "GET",
url : "/include/class/fly.php",
data : "a=b",
async : false,
beforeSend: function()
{
$(document.body).find('.blackwindow').remove();
$(document.body).find('.nospam').remove();
},
complete: function()
{
},
success : function(msg)
{
$(document.body).append(msg);
$('.blackwindow').css({
'opacity':'0.90'
});
$('.nospam').find('input[type="button"]').live("click", function()
{
// final validation
var security= $('.nospam').find('#security').val();
var random = $('.nospam').find('#random').val();
if (random!=security)
{
alert ('Invalid captcha.');
return false;
} else {
// Basically its second time? and return true?
}
});
}
});
//return false;
});
});
<form method=post action=thanks.php class="callmeback">
<input type=text value=100.00 name=amount />
<input type=submit value=submit name=submit />
</form>
Part 2: fly.php
<? require_once 'obj.php';?>
.blackwindow {
position:fixed;
top:0px;
left:0px;
width:100%;
height:100%;
z-index:1000;
background-color:#000000;
}
.nospam {
position:fixed;
top:30%;
left:30%;
padding:12px;
border:solid 3px #686868;
background-color:#ffffff;
z-index:1001;
}
<div class="blackwindow"></div>
<div class="nospam">
<div>
<?
$value = obj::getRandom();
echo '<img src="include/class/return_img.php?number=' . $value . '" />';
echo "<input type='hidden' id='random' name='random' value='$value' />";
?>
<div>
*Please enter the above code below, to verify this request <br/>
<input type="text" class="textbox" id="security" name="security" />
</div>
</div>
<div>
<input type=button name=mybutton value="Verify" />
</div>
</div>
跟进(校对):
$(document).ready(function()
{
$('.callmeback').find('input[type="button"]').live("click", function()
{
$.ajax({
type : "GET",
url : "/include/class/fly.php",
data : "a=b",
async : false,
beforeSend: function()
{
$(document.body).find('.blackwindow').remove();
$(document.body).find('.nospam').remove();
},
complete: function()
{
},
success : function(msg)
{
$(document.body).append(msg);
$('.blackwindow').css({
'opacity':'0.90'
});
$('.nospam').find('input[type="button"]').live("click", function()
{
// final validation
var security= $('.nospam').find('#security').val();
var random = $('.nospam').find('#random').val();
if (random!=security)
{
alert ('Invalid captcha.');
return false;
} else {
$('.callmeback').submit();
}
});
}
});
//return false;
});
});
最简单的方法是使"提交"按钮实际上不是<input type='submit'>
按钮,而是标准的button
按钮。如果验证通过,您可以使用$('form').submit()
或类似的东西手动提交论坛。
相关文章:
- Javascript生成的表单未提交
- 键入最后一位数字后自动提交
- 如何记住提交/刷新后使用的最后一个选项卡
- 在最后按钮之前禁止提交表单-避免编辑页面
- 使用 Java 脚本或 PHP 提交后保留输入框的最后一个值
- 在复选框更改时提交表单不会提交最后一个复选框
- 输入最后一个字段后自动提交/刷新信息路径表单
- 收集异步调用并提交最后一个
- 如何在多页面中制作一个 JavaScript 表单向导,其中包含下一页,并取消并返回并提交最后一页
- 我想在下拉列表的最后一个选项被选中时提交表单.选项是动态生成的
- jquery焦点,并在最后一个输入被填充后自动提交
- 一次提交多个表单将中止除最后一个表单外的所有表单提交
- Ajax请求只提交最后一个
- AngularJS多步骤表单-按enter键应该会移动到下一步,并在最后一步提交
- 使Javascript函数忽略最后一个li来提交表单
- 表单插件与多个表单|提交返回最后一个表单
- 必须勾选最后三个复选框才能提交
- 本地存储保存表单N页数据,直到最后提交
- 提交和下载时的冗余字符:额外的"?"最后
- 如何暂停表单提交,最后一次验证,在最后和之后释放/触发/继续提交