将基础5升级到6后,我遇到了验证问题。即使我输入了正确的数据,它仍然表示无效。
{
"Medical": {
"id": 5,
"companies": [
{
"company": "abc",
"id": 1,
"employees": [
{
"id": 1,
"name": "Matthew"
},
{
"id": 2,
"name": "Mark"
},
{
"id": 3,
"name": "Luke"
},
{
"id": 4,
"name": "John"
},
{
"id": 5,
"name": "Paul"
}
]
}
]
}
}
答案 0 :(得分:0)
示例:
<form id="testForm" data-abide novalidate>
<p>Please enter your email address to recover password.</p>
<div data-abide-error class="alert callout" style="display: none;">
<p><i class="fi-alert"></i> There are some errors in your form.</p>
</div>
<div class="row">
<div class="small-12 columns">
<label>Email Address
<input type="email" name="email" placeholder="Please enter your email address" required>
</label>
</div>
</div>
<div class="row">
<button class="button small radius expanded success btn-block" id="testFormsend">
Send Password Reset Link
</button>
</div>
</form>
<script>
$("#testFormsend").on('click', function(e) {
$("form#testForm").submit();
e.preventDefault();
var invalid_fields = $("form#testForm").find('input.is-invalid-input');
if(invalid_fields.length === 0){
console.log("form ok");
} else {
console.log(invalid_fields);
}
});
</script>