Thx for the hint Jonh.Well when i try to change status from 1 to 0 (checkbox
unchecked) here is what debug prints:
Array
(
[User] => Array
(
[status] => 0
[id] => 54
)
)
Which it seems ok to me...i cant understand what's going on.The status has
been changed but it cant be saved.
2009/5/5 John Andersen <[email protected]>
>
> Try to put a debug statement into the controller in the change_status
> method, to see that it is getting invoked!
> For example "debug($this->data);"
> Enjoy,
> John
>
> On May 5, 1:47 pm, Paulos23 <[email protected]> wrote:
> > Hello people,
> > I am facing a really weird problem with an issue.I have a field in
> > users table which is called status.I have set it to tinyint(1) not
> > null default '1',which means user status is active.Now when i want to
> > change his status to inactive--> '0'
> > i use a checkbox as it is more appropriate,so if i leave it unchecked
> > User.status become inactive.The weird thing is that when i do that the
> > action in users_controller which is called change_status does
> > NOTHING.No errors,no saving new data...just nothing.I wonder if there
> > is a bug with checkbox button or something else.
> > Here i put my code..Plz if you have any ideas i 'd be glad.
> >
> > Thx in advance!
> >
> > views/users/change_status.ctp
> >
> > <h1>User Status Change</h1>
> >
> > <?php
> > echo $form->create('User', array('action' => 'change_status'));
> >
> > echo $form->input('User.status', array ('type' =>
> > 'checkbox','label'=> 'Active'));
> >
> > echo'<p>Set the user account as active or inactive </p>';
> > echo $form->input('id', array('type'=>'hidden'));
> > echo $form->end('Save');
> > ?>
> >
> > controllers/users_controller
> >
> > function change_status($id=null){
> > //$this->User->id = $id;
> > if (empty($this->data)) {
> > $this->data = $this->User->read(null, $id);
> > } else {
> > if ($this->User->save($this->data)) {
> > $this->Session->setflash('User status has been
> updated!');
> > $this->redirect('/users');
> > }
> > }
> > }
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---