Validate form without model


I need to validate fields of a form without the form is the representation of a model. The class performs the validation only on the validated model.

This page is indicated Cmodel as first parameters

Is there a way to do validation without creating the model?

Try use the function validateValue().


If you want to validate the value is a valid email address.


$v=new CEmailValidator();



but that method is only available for e-mails and urls, but not for all types of data. It also does not checks if the field is empty. Other tips?

You may extend the Validator for a custom.


class MyNumberValidator extends CNumberValidator {

     public function validateValue()


          // your code here



mmm. really looking for something ready. I guess I have to choose this path. if anyone has other solutions are well


Declare a class extending CFormModel. Those can have rules just like classes extending CActiveRecord.