I'm developing a web application using php and yii framework. Yii generates validation rules based on your tables and checks user input before the data is entered. I would like to validate the data against yii's rules but not enter the data into the database yet, but rather store it in a session? Is that possible and how can i accomplish that?
Tell me more
×
Programmers Stack Exchange is a question and answer site for
professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.
|
|
to receive a proper validation first all the rules have to be set in the model. like this
f.e. if you want to validate user input from a CHtml::form you do domething like this
its also possible to validate a CHtml::form with ajax.... just add this to the controller
the form wold look like this then with enableAjaxValidation = true,
there are also the methods beforeValidate and afterValidate... validate() in general is always called before save ... but if you really want to access the errors before wanting to save them ... validate() and getErrors() could help you |
||||