Can me using jquery validate in create form that generated by gii tool before.
Cause I’d tried to code an simple jquery validate but it bring me some syntax error.
If I using jquery to validate, the validate code must use the name of elements in form.
My code :
echo $form->textField($model,'studName', array('size'=>15,'maxlength'=>12);
And when it display, I used firebug to show there code in Html format: Student[studName].
So, when I code an jquery validate like:
Any idea? .
I think this post should be in the general discussions, but anyway…
Correct me if I’m wrong, but does Student[studName] refers to the “name” attribute of your textfield? You may try using the “id” instead, which might be in the format Student_studName like this:
I included the ‘#’ sign because that’s how ‘id’ attribute is called usually by jquery (see this link). I don’t know what the validate() function does, but hopefully I have given you an idea.
Thanks so much Macinville, I’ll try and response to you