Client-side validation quirk

Hi all, perhaps a n00b question, but I’ve tried searching the forum and came up zip! So, my first post…here goes…!

I’ve created a base web app by using the yiic tool. This is working fine - and amazed at how awesome Yii is!!

On the sample "Contact" page of the app that was generated, if an input field (eg. Name) gains focus, and then you tab out of the field with out entering anything it displays a nice error message.

Then I created my own form, within the same app, and when I do the same steps as above, it will not show the error message. However, if I were to type some text, tab out of the field, it does change the colour of the field to indicate the input is valid. And if I go back in to the field and delete all the text and tab out again, it will now show the error message.

I’ve followed the guides and correctly added the rules in my model (required etc), and have set “enableClientValidation” to true (obviously, since it starts to work after entering some text).

Am I missing something obvious here?

Thanks in advance! :)

Have you tried setting enableAjaxValidation=>true as well ?

hi ykamakazi, yeah tried that as well, same outcome. Actually if I enable ajax validation together with client validation, client validation stop working altogether.

This is my code:

$form=$this->beginWidget('CActiveForm', array(










onChange and onType validation works with no prob.