Php jquery.validate不适用于选择框
我正在尝试为我的表单提供验证规则。。对于每个字段,它都可以正常工作,但对于选择框,它不能正常工作Php jquery.validate不适用于选择框,php,jquery,css,cakephp-1.3,Php,Jquery,Css,Cakephp 1.3,我正在尝试为我的表单提供验证规则。。对于每个字段,它都可以正常工作,但对于选择框,它不能正常工作 <script type="text/javascript"> jQuery(document).ready(function() { jQuery('form#EnrollmentAccountHolderInformationForm').validate({ // ignore: function(){ // retu
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery('form#EnrollmentAccountHolderInformationForm').validate({
// ignore: function(){
// return $('form#EnrollmentAccountHolderInformationForm input:hidden, form#EnrollmentAccountHolderInformationForm select');
// },
debug: false,
rules: {
"data[Enrollment][personalinfo_source]": {
required:true
},
"data[Enrollment][person_last_name]": {
required:true
}
}
});
这是我的选择框名称;-数据[注册][个人信息\来源]
下面是选择框的代码:-
<h4 style="line-height:17px;">How did you hear <br/>about us?*</h4>
<?php $options = array(
'Event Sponsorship' => 'Event Sponsorship',
'Internet'=>'Internet',
'Newspaper' => 'Newspaper',
'Outdoor Advertising' =>'Outdoor Advertising',
'Radio' => 'Radio',
'Telemarketing' => 'Telemarketing',
'Television' => 'Television',
'Social Media' =>'Social Media',
'Other'=>'Other');
echo $this->Form->input('personalinfo_source',array('label'=>false,'id'=>'select','class' => "selectbox",'div'=>false,'options'=>$options, 'tabindex' => '16', 'empty' => 'Select','style' => "width:215px;"));
?>
<div style="clear:both"> </div>
帮帮我。你检查过你的HTML代码了吗?根据您的php代码“id”=>“select”。选择框id为select not EnrollmentAccountHolderInformationForm,我不确定