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

  1. Documentation
  2. Change Log

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.

Validators:

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

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.

Resources

Documentation

Requirements
  • Yii 1.2 or above
Installation
  • Extract the release file under protected/extensions
Usage

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.
3 0
1 follower
698 downloads
Yii Version: 1.1
License: BSD-2-Clause
Category: User Interface
Tags:
Developed by: Rangel Reale
Created on: May 29, 2010
Last updated: 13 years ago

Downloads

show all