Hi Mathew,

thanks for the help (and sorry for the delay in answering). That's a 
good idea and I followed your advise, but still one problem persists:
If, in step 3 there is something wrong in validation, cake will return 
to the form again. But now, the ID is no longer in the URL, so there is 
an error about that.

I think, passing a parameter along the URL is a pretty common task, 
isn't it? There should be more support for that in cake. For example, if 
I add it to the form action (helper), cake gets all confused about it. 
Yet, that would be the simplest solution.

Best Regards,
Daniel Süpke

Mathew wrote:
> Hi Daniel,
> 
> You want to include the ID in the URL so that it persists when
> bookmarked, and using a session doesn't provide that feature.
> 
> I understand what your trying to do, but the form action does not
> require the ID to be included, because posted form requests first
> require an HTML page to display the form.
> 
> Let me example.
> 
> 1) User follows a link with the ID.
> 2) HTML with the form is shown in the browser, with the ID in the URL.
> 3) User enters form data, and submits the form.
> 4) A response from the server is shown to the user.
> 
> In step #2 when the form is displayed. You should take the ID from the
> URL and add it as a hidden field in the form.
> In step #3 the action that handles the form request does not need the
> ID in the URL because it will be in the posted data.
> In step #4 as part of the response you redirect the user to a URL that
> contains the ID.
> 
> Also.
> 
> I would create a simple Helper object for your views. Not one that
> creates an HTML link, because Cake comes with Form and Html helpers to
> do that. All you need to do is modified a Router array to include the
> ID
> 
> for example;
> 
> $html->link('Somewhere',$myhelper-
>> id(array('controller'=>'documents','action'=>'show')));
> 
> You create a helper called Myhelper, and add a function called "id"
> that injects your ID from the URL into the array. Now you can call all
> various helper objects that require routed links.
> 
> I think you can inject the ID as a get request like this (I can't
> remember how to handle gets with params, but I think its like this)
> 
> function id( $arr )
> {
>   $arr['?'] = array('id'=>$this->params['id']);
> }
> 
> That should provide Html that looks like this in your view
> 
> <a href="/documents/show?id=#####">Somewhere</a>
> 

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to