Tuesday, December 1, 2009

Re: Delete confirm

Thanks for the reply. I guess it is a tad unreasonable to expect two
year old code to 'just work'! I just like stuff out of the box :-)

I'll follow your suggestions and then rather than slavishly try and
make this function I'll branch off my own way until I get something
working. I'll post back my solution here.

On Dec 1, 9:34 am, AD7six <andydawso...@gmail.com> wrote:
> On 27 nov, 12:28, jburns <jeremybu...@me.com> wrote:
>
>
>
>
>
> > @AD7Six
>
> > Apologies, but I am still struggling with this. I have deployed your
> > code as is, with the following changes:
>
> > I have removed this line:
> > if (isset($this->params[CAKE_ADMIN]) && !$this->RequestHandler->isAjax
> > ()) {
> >             $this->layout = 'admin';
> >         }
> > ...because it errors and is not relevant to me.
>
> > Same with this line:
> > if ($this->javascripts) {
> >             $this->set('javascripts', $this->javascripts);
> >         }
>
> > I am not using admin routing, so have changed references to
> > admin_delete to delete.
>
> > This line errors:
> > $this->Security->__generateToken($this);
> > ...but works if I change the double underscore to a single underscore.
>
> > I have created the _generic folder and put the confirm_action view in
> > it.
>
> > I *think* I understand what is going on in the code. It picks up that
> > I am calling the delete action via a link (and therefore a GET). As
> > 'delete' is in the $postActions array, I am directed to the
> > _confirmAction function. This renders the confirm_action view, which
> > contains a form that calls the delete action via a POST. When I submit
> > the form it ought to come back into app_controller and pass through to
> > the delete action. However, I am still being directed back to the
> > confirm_action view.
>
> > Stumped. I notice that it is calling Security->_generateToken. Should
> > this be being picked up anywhere else? If not, what is its purpose?
>
> > I appreciate your help. This is gnawing away at me and I can't work it
> > through.
>
> > Thanks.
>
> Without seeing your exact code I|other people can't help much.
>
> Yes, the core changed a little in the past 2 years, as did a few other
> things. e.g. I personally don't use a _generic folder anymore since
> you can just do $this->render('/elements/this_one'); - as can be seen
> in the repo solution I linked to.
>
> If you're being redirected to confirm_action in a loop the form token
> that's generated 'manually' (see the form helper create function if
> you want to see what else uses it) doesn't match what the security
> component is expecting. Except for the period of time when I was
> originally writing this technique - I haven't seen that happen. You'd
> need to debug and find out why.
>
> hth,
>
> AD

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

No comments: