Hello -

Did you ever get some answers on that. I have the same problem. I have
2 forms on my page and I am not sure how to manage them!

-V
willi wrote:
> Hi there!
>
> I'am very impressed about the huge capabilities of CakePHP and about
> to create a bigger application after playing around and figuring out,
> how things go.
>
> Now I'am a little confused, how to create things like multiple forms
> (with a dedicated model) in one view.
>
> I have two controllers: categories and images, with coresponding
> models and views, each controller with index/list/add/edit/delete
> functions.
>
> I want to have a view, that displays the categories/add form, the
> images/list table and the images/add form on one page. I did this,
> using the requestAction method in the images/index view like this:
>
> <?php echo $this->requestAction("/categories/
> add",array("return"=>true)); ?>
> <?php echo $this->requestAction("/images/add",array("return"=>true)); ?
> >
> (The images/list ist called by the images/index method)
>
> No problem so far.
>
> But now i want to do some validations and the error messages,
> depending on which form was submitted, should be displayed in the same
> view - no dedicated errorpage - everything in only this one view or
> one page if you want.
>
> I did something like this for the categories and images controller:
>
>       function add() {
>               if(!empty($this->data)) {
>                       $this->cleanUpFields();
>                       $this->Category->create();
>                       if($this->Category->save($this->data)) {
>                               $this->Session->setFlash('Success!');
>                               $this->redirect('../images/index');
>                               exit();
>                       } else {
>                               $this->Session->setFlash('Error!');
>                               $this->render('../images/index');
>                       }
>               }
>       }
>
> But I get no error messages and the forms were not populated.
>
> When I use $this->render();
>
> instead, I get errormessages, the form will be populated, but I only
> get the add-view - shure ...
>
> To cut a long story short: How do I handle the output of multiple
> forms in one view in an elegant way!?
>
> Thank you in advance!
>
> Willi


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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