Parsley 库是否适用于复选框以及 bootstrap 的向导 class。如果是怎么预防呢?
Is parsley lib work on check boxes and also for wizard class of bootstrap. if it is how to prevent it?
在我的网络应用程序中,我制作了两个 <fieldset>
,一个用于四个 <input>
字段,一个用于
checkboxes
。现在我在这些 <fieldset>
上使用 this parsely lib 它无法正常工作。但它适用于已创建不同字段的其他页面。现在我不太了解这个库是否在 checkboxes
上工作。而且我不想在这些 checkboxes
上应用解析库。
所以我的问题是:
- 为什么它在我的 webapp 中给出的以下代码上不起作用
一页但在另一页上有效。?
代码如下:
<form id="form1" action="" method="POST" enctype="multipart/form-data" >
<input type="hidden" id="user_id" name="user_id" value="<?php echo empty($user_id)?"":$user_id;?>" />
<fieldset>
<legend>Basic Info</legend>
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label for="name">First Name *</label>
<p id="validation"></p>
<input type="text" class="form-
control" id="fname" name="fname" value="<?php echo empty($fname)?"":$fname;?>"
placeholder="Enter First Name" data-type="alphanum" maxlength="45"/>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="email">Last Name *</label>
<input type="text" class="form-control" id="lname" name="lname" value="<?php echo empty($lname)?"":$lname;?>" placeholder="Enter Last Name" data-type="alphanum" maxlength="45"/>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label for="name">Email *</label>
<input type="text" class="form-
control" id="email" name="email" value="<?php echo empty($email)?"":$email;?
>"
placeholder="Enter Email" data-type="alphanum" maxlength="45"/>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="email">Mobile #</label>
<input type="text" class="form-control" id="mobile" name="mobile" value="<?php echo empty($mobile)?"":$mobile;?>" placeholder="+55 99 99999999" data-type="alphanum" maxlength="45"/>
</div>
</div>
</div>
<div class="row" style="display:none;">
<div class="col-md-6">
<div class="form-group">
<label for="status">Status</label>
<div>
<span class="text-muted m-l-5">InActive</span>
<input type="checkbox" data-render="switchery" id="status" name="status" data-theme="default" checked />
<span class="text-muted m-l-5">Active</span>
</div>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="status">All Permissions</label>
<div>
<span class="text-muted m-l-5">No</span>
<input type="checkbox" data-render="switchery" id="status" name="status" data-theme="default" checked />
<span class="text-muted m-l-5">Yes</span>
</div>
</div>
</div>
</div>
</fieldset>
<fieldset>
Here for checkboxes
</fieldset>
我找到了问题的答案。花了一个小时后 reading official docs.It 说
Checkbox, radio and select multiple are a bit different than regular
input, textarea or simple select. They need to have either a name or
an id attribute to be correctly bound and validated by Parsley.
Otherwise, they will be ignored and a warning will be put in the
console.
在我的网络应用程序中,我制作了两个 <fieldset>
,一个用于四个 <input>
字段,一个用于
checkboxes
。现在我在这些 <fieldset>
上使用 this parsely lib 它无法正常工作。但它适用于已创建不同字段的其他页面。现在我不太了解这个库是否在 checkboxes
上工作。而且我不想在这些 checkboxes
上应用解析库。
所以我的问题是:
- 为什么它在我的 webapp 中给出的以下代码上不起作用 一页但在另一页上有效。?
代码如下:
<form id="form1" action="" method="POST" enctype="multipart/form-data" >
<input type="hidden" id="user_id" name="user_id" value="<?php echo empty($user_id)?"":$user_id;?>" />
<fieldset>
<legend>Basic Info</legend>
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label for="name">First Name *</label>
<p id="validation"></p>
<input type="text" class="form-
control" id="fname" name="fname" value="<?php echo empty($fname)?"":$fname;?>"
placeholder="Enter First Name" data-type="alphanum" maxlength="45"/>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="email">Last Name *</label>
<input type="text" class="form-control" id="lname" name="lname" value="<?php echo empty($lname)?"":$lname;?>" placeholder="Enter Last Name" data-type="alphanum" maxlength="45"/>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label for="name">Email *</label>
<input type="text" class="form-
control" id="email" name="email" value="<?php echo empty($email)?"":$email;?
>"
placeholder="Enter Email" data-type="alphanum" maxlength="45"/>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="email">Mobile #</label>
<input type="text" class="form-control" id="mobile" name="mobile" value="<?php echo empty($mobile)?"":$mobile;?>" placeholder="+55 99 99999999" data-type="alphanum" maxlength="45"/>
</div>
</div>
</div>
<div class="row" style="display:none;">
<div class="col-md-6">
<div class="form-group">
<label for="status">Status</label>
<div>
<span class="text-muted m-l-5">InActive</span>
<input type="checkbox" data-render="switchery" id="status" name="status" data-theme="default" checked />
<span class="text-muted m-l-5">Active</span>
</div>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="status">All Permissions</label>
<div>
<span class="text-muted m-l-5">No</span>
<input type="checkbox" data-render="switchery" id="status" name="status" data-theme="default" checked />
<span class="text-muted m-l-5">Yes</span>
</div>
</div>
</div>
</div>
</fieldset>
<fieldset>
Here for checkboxes
</fieldset>
我找到了问题的答案。花了一个小时后 reading official docs.It 说
Checkbox, radio and select multiple are a bit different than regular input, textarea or simple select. They need to have either a name or an id attribute to be correctly bound and validated by Parsley. Otherwise, they will be ignored and a warning will be put in the console.