Yii 1.1: wvactiveform

wvActiveForm is a CActiveForm descendant that validates the input on client with jQuery, using model or custom rules.
1 follower

wvActiveForm is a CActiveForm descendant that validates the input on client with jQuery, using the rules defined at the model, while also supporting custom rules. Besides validation some rules may also filter invalid characters during typing.


  • Required
  • Number
  • String (length)
  • Email
  • Default value (displays value that disappear on field click)
  • No whitespace
  • URL
  • Manual rules


  • jQuery.Validate
  • jQuery.Numeric
  • jQuery.DefaultValue
  • jQuery.keyFilter

CValidator supported:

  • CRequiredValidator
  • CStringValidator
  • CNumberValidator
  • CEmailValidator
  • CUrlValidator

Starting with 0.7, now wvActiveForm supports layouts for error messages. Just add a 'layoutName' paramater to the form. There are 2 built-in layouts, 'default' (which is compatible with the default Yii error messages) and 'qtip', based on jQuery.qtip.




  • Yii 1.2 or above


  • Extract the release file under protected/extensions


Just replace the CActiveForm class with wvActiveForm, and you should automatically get client validation if you use validators on your model.

See the following code example:

<?php $form = $this->beginWidget('ext.wvactiveform.wvActiveForm', array('id'=>'form')); ?>
<?php $this->endWidget(); ?>

To do manual validation, just add an 'validators' option to the field's htmlOptions:

<?php echo $form->textField($model,'ds_login_adm',array('size'=>20,'maxlength'=>20,
            'validators'=>array( 'nowhitespace'=>true ))); ?>

To use layouts, add a 'layoutName' parameter:

<?php $form = $this->beginWidget('ext.wvactiveform.wvActiveForm',
    array('id'=>'form', 'layoutName'=>'default')); ?>

Change Log

Jun 2, 2010

  • Version 0.7
  • Layout class support
  • wvActiveFormLayoutDefault deprecated, use the 'layoutName'=>'default' form parameter.
  • Added "qtip" layout, that uses jQuery.qtip to display messages.
  • BUGFIX: changed 1 line in jQuery.validate to make it compatible with Yii's checkbox and radiobutton use of hidden fields. Because of this, the minified version of jQuery.validation is disabled.

May 30, 2010

  • Version 0.61
  • BUGFIX: PHP < 5.3 doesn't have lcfirst()

May 29, 2010

  • Initial release.

Total 2 comments

#178 report it
CGeorge at 2010/08/18 05:21am

Saves a lot of work!

#246 report it
lichunter at 2010/07/28 08:32am
Great extension...!!!

Please, keep working on it... It just do a lot of programming task...!!

Congratulations for your work !!!

Leave a comment

Please to leave your comment.

Create extension