My jQuery code is:
$(document).ready(function(){
$(\'#StudentRegisterForm\').validate({
rules: {
email: {
required:true,
The first one is better to use, because this will maintain cake this->data structure
, but second one is not. This is to remind that, when you will use the data[modelname][fieldname]
give the class name in the input aray like:
<?php echo $form->input('email',array('type'=>'text','class' => array('required','email'),'error'=>false,'label'=>false,'div'=>false)); ?>
You need just need a minor tweak, set the rule using a string, like this:
$(function(){ //short for $(document).ready(function(){
$('#RegisterForm').validate({
rules: {
"data[Student][email]": {
required:true,
email:true
}
}
});
});
I had exactly this problem yesterday. The answer is to 'force' the name on the input field, like:
echo $form->input('cheque_number',array('name'=>'InvoiceChequeNumber','value'=>''));
I spent a while trying to avoid doing that, but I couldn't find any alternative. There are no problems for CakePHP when you do it like this.