Monday, December 1, 2008

Re: How to use Prefix Routing for form submit

Hi ,

I got solution for above problem but facing a new problem in case of
edit

echo $form->create(null, array('url' => array('controller' =>
'blogs', 'action' => 'education_index', 'education' => true), 'name'
=> 'blogform'));

it's generating url : <form name="blogform" id="BlogIndexForm"
method="post" action="/project_name/education/blogs/index/">

this is working fine but in case of edit it's generating unexpected
result

echo $form->create(null, array('url' => array('controller' =>
'blogs', 'action' => 'education_edit', 'education' => true, 'id' =>
'12'), 'name' => 'blogform'));

<form name="blogform" id="BlogeditForm" method="post" action="/
project_name/blogs/education_edit/12/education:1/">

action : /project_name/blogs/education_edit/12/education:1/ is
unexpected...it must be /project_name/education/blogs/edit/12/

I debug this problem and find that it's due to sending $this->data
from controller in edit case.

why is it happening in edit case ?

Is there any solution for this?

Thanks


On Dec 1, 10:01 am, bookme <rarockthewo...@gmail.com> wrote:
> Thanks Kyo,
>
> Your solution is working fine but sometimes I am not using URL asform
> action in this case I am finding problem...
>
> like if url ishttp://localhost/test/education/blogs/add/
>
> and I want to handaleformpost action on education_index then your
> suggested solution is not working....
>
> Please tell me how should I do this?
>
> Thanks
>
> On Nov 28, 6:54 pm, Kyo <ready2jam2ni...@yahoo.co.jp> wrote:
>
>
>
> > Try something like:
>
> >         echo $form->create(null, array('url'=>"/{$this->params['url']
> > ['url']}"));
>
> > $params['url']['url'] holds the url of the current page.
> > That should do the trick.
>
> > hth- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
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: