Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class Prueba extends CActiveRecord
- {
- public $fechaString;
- public function rules()
- {
- return array(
- array('fechaString','convertir_fecha'), // <---AQUI
- array('fecha, fechaString', 'required'), // <--- AQUI
- array('fechaString', 'length', 'max'=>20), // <--- Y AQUI
- array('idprueba, fecha', 'safe', 'on'=>'search'),
- );
- }
- public function convertir_fecha($attr, $params){
- $this->fecha = CDateTimeParser::parse($this->fechaString,'dd/MM/yyyy');
- if($this->fecha == null)
- $this->addError('fecha','La fecha es requerida.');
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement