Yii Framework Forum: rules required on create - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

rules required on create Rate Topic: -----

#1 User is offline   zipzap 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 314
  • Joined: 13-January 12

Posted 08 July 2012 - 08:00 AM

I have this rule on the model:

array('pass','required','on'=>'create'),


it seems that the on create action doesnt work....
0

#2 User is offline   twisted1919 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 640
  • Joined: 23-October 10
  • Location:Romania

Posted 08 July 2012 - 08:12 AM

the 'on' is the scenario, so you'd instantiate the model like:
$model=new Model('create');

if you want to apply the create scenario.

Yii's default create scenario is insert and the update scenario is, well, update.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users