Hello,
I faced two problems concerning CValidator:
- My app is in Russian, so it needs 2 bytes for a letter in strings. Concequently, I have to redouble length max-min limit in CStringValidator.
It works, but user gets something enigmatical error message, because "real" (alphabetical) symbol limit less by half. I tried divide by 2 this {max} placeholder in the message, but unsuccessful. Something looks as
$max = (float)'{max/2}'/2.;
gives zero values in result, but something as
$max = settype(settype('{max}','float'),'string');
throws the error:
Fatal error: Only variables can be passed by reference in Z:\home\dtz.tasks\www\protected\messages\ru\yii.php on line 18
So, does any way exist to transform arithmetically placeholder's value?
- I attempted to do something using custom message. I was strongly following instructions, and my rules function is as follows (see the third array - validation 'length' for 'comment' attribute):
<?php public function rules() { return array( array('u_init_id, date_change, ref_status_id, customer_id, ref_type_id, ref_terminal_id, ref_object_id, deleted', 'required'), array('u_init_id, u_resp_id, ref_status_id, customer_id, ref_terminal_id, ref_type_id, ref_object_id, deleted', 'numerical', 'integerOnly'=>true), array('comment','length','max'=>1000, 'message'=>'some test!!!'), array('date_plan', 'type', 'type'=>'date', 'dateFormat'=>'yyyy-MM-dd') ); } ?>
I got the old sytem message only, nothing more… Wat's wrong?
Thank you for any help!