CONTROLLER

        function admin_edit($id)
        {
                debug($this->data);
                if(!empty($this->data))
                {
                        $this->Category->save($this->data);
                }
        }


APP CONTROLLER

                var $components = array('Security');
                var $helpers = array('Form','Javascript');

                public function beforeFilter($https=false)
                {
                        if(     !empty($this->params['admin'])
                                        &&
                                $this->params['admin']=='1'
                                        &&
                                $this->Session->check('Auth.User')
                                        &&
                                $this->Session->read('Auth.User.level')!='admin'
                        ){
                                $this->cakeError('error404');
                        }
                        elseif(!empty($this->params['admin']) && $this-
>params['admin']=='1')
                        {
                    $this->Security->blackHoleCallback = 'forceSSL';
                                $this->Security->requireSecure();
                                $this->layout='admin';
                        }
                        elseif(!$https && !in_array($this->action, 
$this->Security-
>requireSecure) and env('HTTPS'))
                        {
                            $this->_unforceSSL();
                        }
                }

                public function forceSSL()
                {
                        $this->redirect('https://' . env('SERVER_NAME') . 
$this->here);
                }
                public function _unforceSSL()
                {
                        $this->redirect('http://' . env('SERVER_NAME') . 
$this->here);
                }


VIEW

        <?php echo $form->create('Category',array('url'=>$this->here))?>
        <?php echo $form->hidden('id')?>
        <?php echo $form->input('name',array('size'=>'50','label'=>'Category
Name'))?>
        <?php if($add) echo $form->hidden('parent_id')?>
        <?php echo $form->input('protected',$protected_disabled)?>
        <?php echo $form->end('submit')?>


On Feb 16, 9:07 am, John Andersen <j.andersen...@gmail.com> wrote:
> How does the beforeFilter code in the AppController look like?
> How does the form in the view look like?
> How does the action code look like in your CategoryController?
>    John
>
> On Feb 16, 6:44 pm, calzone <calz...@gmail.com> wrote:
>
>
>
> > This is a problem I just came up against and I can't figure out what
> > might be causing it.
>
> > I have a Category model that actsAs tree.
>
> > When I submit a form to edit or create a category, nothing happens.
> > Adding debug code to my controller to output the value of $this->data
> > as the very first line in the action, I see that it is an empty array.
> > So clearly, the array is being defined, but not populated.
>
> > Or else something is depopulating it?
>
> > What could cause such behavior?
>
> > The model has no validation or anything else defined in it other than
> > actsAs.  The controller has no beforeFilter.  However, I am running
> > cakephp authentication and this page is requires authentication and
> > runs under https.  These are managed in the app_controller but this
> > has not presented any kind of problem for any of my other models.
> > Only the Category model is affected. Incidentally, I have no trouble
> > with $this->Category->read(null,$id) to populate my form with
> > information about a category (I added my root category manually to the
> > db).

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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to