Thursday, November 4, 2010

Named parameters, forms and redirects

I'm passing a foreign id to my models add funtion via a URL such as

/model/add/foreign_id:1

The /add/ method generates an error and redirects if it does not
receive this parameter.

I assign the foreign id to the model and it auto populates the form

if(isset($this->passedArgs['foreign_id']))
$this->data['model']['foreign_id'] = $this->passedArgs['foreign_id'];

This all works, until the form has a validation error and has to be re-
displayed to the user. The URL then changes to

/model/add/

So the foreign_id information is then lost.

Firstly, is what I'm doing correct, and how can I fix this issue?

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

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate