$roles) ); [/CODE] works
thanks !
On Mar 24, 5:46 pm, cricket <zijn.digi...@gmail.com> wrote:
> On Mar 24, 4:29 pm, hvannia <hvan...@gmail.com> wrote:
>
> > I have a controller where i get the user roles and set them so they
> > can be displayed on the view as a select list within a form.
> > This part is OK, but when i Save the form all the fields but this
> > field ( role ) is not saved, all other fields including the rAdiO
> > button
> > selection are saved,
> > do i need to do something else ?
>
> The first thing I'd do in that situation is place die(debug($this-
>
>
>
>
>
> >data)); right after the if (!empty($this->data)) line.
> > here's the relevant code:
>
> > in users_controller:
> > var $belongsTo = array('Role' => array ( 'className' => 'Role',
> > 'foreignKey'=>'role_id' ));
> > .....
> > $this->set('roles',$this->Role->find('list',
> > array('fields'=>array('Role.id','Role.role'), 'order'=>'Role.role
> > DESC')));
> > ....
>
> > in roles_controller:
> > var $name='Roles';
> > var $hasMany='User';
>
> > in user register view:
> > echo $form->input('rol',array('options'=>$roles) );
>
> Is that a typo? Try:
>
> echo $form->input('User.role_id',array('options'=>$roles) );
>
>
>
> > browser shows:
> > INSERT INTO `users` (`username`, `password`, `email`, `ext`, `status`,
> > `modified`, `created`)
> > (role should be right after ext. )
>
> > Any help is appreciated, I've got much to learn
Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
To unsubscribe from this group, send email to cake-php+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
No comments:
Post a Comment