我是第一次使用Codeigniter。我有问题,我使用下面的验证
$(document).ready(function($){
$('#form1').validate({
rules: {
city:'required',
state: 'required',
emailid: {
required:true,
email: true
},
location: 'required',
pincode: 'required',
address: 'required',
address: 'required',
mobilenumber: {
required:true,
minlength:10,
maxlength:10,
number: true
},
},
messages: {
city: 'City Name is required',
state: 'State Name is required',
location: 'Location is required',
category: 'Category is required',
emailid: {
required:'Email ID is required',
email: 'Invalid Email ID'
},
mobilenumber: {
required: 'Contatc Number is Required',
minlength:'Minimum 10 digits only',
maxlength:'Maximum 10 digits only',
number: 'Only numeric allowed'
}
}
});
});
在此处选择下拉列表中的城市,州和位置,因此验证不起作用。我的选择下拉列表如下
<select id="state" name="state" class="form-control chosen-select" data-rule-required="true" data-msg-required="Please include your State." onchange="getcity()">
<option value="0">State</option>
<?php
foreach($allstates as $row)
{
if($state==$row->stateid){
echo '<option value="'.$row->stateid.'" selected>'.$row->state.'</option>';
}else{
echo '<option value="'.$row->stateid.'">'.$row->state.'</option>';
}
}
?>
</select>
这是我的下拉列表