Adding Rules For Create

hye friends… i want to apply rule only for create. not for Update.

this is my rule, this validation does not work in the create also.

array('password','userPass','on' => 'create'),

so please help me out how can i use this validation only in create page.

Thank you…

Use scenario "insert" instead:

array('password','userPass','on' => 'insert'),

When you create a new instance of a model, it’s default scenario is “insert”. See documentation.

Read about scenarios here.

Thank you paul G… its working… thanks a lot.