1

I have form in YII and it needs to change model rules dynamically. Is it possible?

tereško
  • 58,060
  • 25
  • 98
  • 150
bzut
  • 11
  • 1
  • 2

1 Answers1

3

Have you looked for Yii's validation scenarios?

http://php-thoughts.cubedwater.com/2009/validation-scenarios/

sadaf
  • 719
  • 2
  • 8
  • 19
  • I added: array('username, email', 'required', 'on' => 'add') in user model and $model->validate('add') in controller but it gives me error – bzut Aug 09 '11 at 01:00
  • Yii has few built in scenarios, for validation while adding a new record, use "insert". similarly you can use "update" and "search" as well. – sadaf Aug 10 '11 at 20:38