Thanks for your reply and suggestions, I have adjusted my code since
and it seems to be working fine, will look at these options as well
and see how I can improve it.

At least it dosn't sound like I am doing something completely wrong.

On Nov 4, 10:05 pm, WebbedIT <p...@webbedit.co.uk> wrote:
> As I suspected, the issue is when you initially request the form you
> are passing it in via $_GET as a named parameter, then when you submit
> the form you change to passing it in via $_POST into the model's data
> array instead.
>
> I actually do it this way myself and have my method specified as
> something like
>
> function add($foreign_id = null) {
>   $foreign_id = $data['Model']['foreign_id'] ? $data['Model']
> ['foreign_id'] : $foreign_id;
>   if (!$foreign_id) {
>     // error
>   }
>
> }
>
> You could move this logic to the controllers isAuthorized() method to
> throw an auth error
>
> function isAuthorized() {
>   switch ($this->action) {
>     case 'add':
>       $foreign_id = $this->data['Model']['foreign_id'] ? $data['Model']
> ['foreign_id'] : $this->params['named']['foreign_id'];
>       if (!$foreign_id) return false;
>       break;
>   }
>   return true;
>
> }
>
> but I think this is wrong as the existence of a foreign_id is not
> really an Auth issue.  The other method would be to  amend $form-
>
> >create in your view so the form submits to '/model/add/foreign_id:1'
>
> No hard and fast answer really.
>
> HTH, Paul.

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