Sunday, October 18, 2009

Re: Loose inputfields and submitbuttons

Never mind!

I found it out already! For the record:

I just added $form->create(null, array('action' => 'refreshcart'')
before the table.

The loose inputfields are then scattered around the HTML table where I
want them as $form->input('Product.'.$id, 'value' => $amount) So they
have a unique name and just a $form->end. after the table.

The action in the controller then gets an array which lists all the
inputboxes as [$id] => [$amount]... A simple foreach loop then
rewrites my Cookie...

So lesson learned: Passing null and ''action' to the form->create
makes your own little form for a specific action and you can scatter
the $form->inputs everywhere you want, as long as they are within the
create and end tags..!


On 18 okt, 14:04, Céryl <c.a.h.wilt...@student.tue.nl> wrote:
> Hello all!
>
> I have run into a little problem myself now.
>
> I'm making a kind of shopping cart, and on the view which shows all
> the info from the cookie (the articles in the shoppingcart) users can
> modify the amount per article.
> It kinda looks like this as an html table
>
> ----
> Amount   Product    Price    Total
> 1            Whatever  5          5
> 3            Whatever  7          21
>
> Refresh
> -----
>
> Now, the amount in the table is an input field (With $form->input),
> and refresh is a link (or submitbutton, i don;t care), which goes to
> an action (refreshcart) that modifies the amount in the cookie and
> refreshes the pages. All have all that logic already, but I can't find
> a way to pass the data from the loose inputfields to my action.
>
> As you can see from the setup, I cannot make a regular form with $form->create etc, since the inputfields and  buttons are in different
>
> tablecells and scattered across the page.
>
> Also, this form doesn't tie in to a database, I just need the entered
> data from the inputfields passed to an action below it...
>
> Any idea's?
--~--~---------~--~----~------------~-------~--~----~
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