表格不会标记每个步骤和错误提交时运行php代码

时间:2016-01-16 01:45:56

标签: jquery idealforms

当所有字段都正确时,msg一切都很好,但是没有运行与isset相关的php代码,如何在显示下一步/表单之前单击下一个btn时标记错误

 <div class="idealsteps-container">
<nav class="idealsteps-nav"></nav>
<form class="idealforms" novalidate autocomplete="off" action="/" method="post">

<div class="idealsteps-wrap"> 

<!-- Step 1 -->

<section class="idealsteps-step">
<div class="field">
<label class="main">Book Name:</label>
<input name="bookname" type="text" >
<span class="error"></span> </div>

<div class="field buttons">
<label class="main">&nbsp;</label>
<button type="button" class="next">Next &raquo;</button>
</div>
</section>

<!-- Step 2-->

<section class="idealsteps-step">
<div class="field">
<label class="main">code:</label>
<input name="code" type="text">
<span class="error"></span> </div>

<div class="field buttons">
<label class="main">&nbsp;</label>
<button type="button" class="prev">&laquo; Prev</button>
<button type="submit" id="btn" name="btn" class="submit">Submit</button>
</div>
</section>
</div>
<span id="invalid"></span>
</form>
<?php
if(isset($_POST['btn']))
{
echo "submitted";
}
?>
<script>
$('form.idealforms').idealforms({

silentLoad: false,

rules: {
'bookname': 'required bookname'
},

onSubmit: function(invalid, e) {
e.preventDefault();
$('#invalid')
.show()
.toggleClass('valid', ! invalid)
.text(invalid ? (invalid +' invalid fields') : 'All good!');

}
});
</script>

目前它只在单击step2中的提交btn时标记错误,如何在进行下一步之前显示该步骤的错误,并在点击最终提交btn时运行php代码

0 个答案:

没有答案