Yii Framework Forum: CFormModel attributes not binded after POST - Yii Framework Forum

Jump to content

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

CFormModel attributes not binded after POST Rate Topic: -----

#1 User is offline   Trejder 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 1,193
  • Joined: 06-October 10
  • Location:Southern Poland

Posted 14 December 2011 - 10:23 AM

Hi,

I have written my new CFormModel by copying and modifying existing CActiveRecord model.

I've changed everything I need, but in rules() I did not change (remove) 'on'=>'search' param from safe validator.

This caused my attributes to not being bind after form submitted. After I removed this parameter everything started to work fine.

Is this a normal situation?

Regards,
Trejder
Proud Cookbook author, though still learning powerful Yii! :] See my generic profile for more information. Cheers!
0

#2 User is offline   Azy 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 156
  • Joined: 16-May 12

Posted 17 February 2013 - 01:13 AM

View PostTrejder, on 14 December 2011 - 10:23 AM, said:

Hi,

I have written my new CFormModel by copying and modifying existing CActiveRecord model.

I've changed everything I need, but in rules() I did not change (remove) 'on'=>'search' param from safe validator.

This caused my attributes to not being bind after form submitted. After I removed this parameter everything started to work fine.

Is this a normal situation?

Regards,
Trejder


i have the same situation in my application. did you have any other solution other than rewriting the CformModel ?

all my attributes are assigned to safe buy yet $model->attributes mass assignment does not hold any values.

any help is highly appreciated.
0

#3 User is offline   lagogz 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 426
  • Joined: 30-November 12
  • Location:Galiza

Posted 17 February 2013 - 03:50 AM

Hi all.

I think the line:

('attibute','safe','on'=>'search')

only works when you do a search.
Then,you could add this line in rules and test:

('attribute','safe')

Are you sure all data is send by post? You can show Firebug notice.

Regards.
-----------------------------------------------------------------------------------------------
------------------------------- VISITEN FOCUCHASART --------------------------------
-----------------------------------------------------------------------------------------------
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