On Sat, Feb 19, 2011 at 11:33 PM, Thomas <[email protected]> wrote:
> Wow, not really sure what to say. The example you provided is pretty
> much what I have now. I still have not gotten an answer. Can cake
> dynamically create the post array key, again referencing this
> example:?
> <input type="text" name="name[]">
> Maybe none of you have seen this because it is not possible in cake.
Maybe we're all idiots.
The empty square brackets thing in form names is very well understood.
The thing is, Cake doesn't use them.
> But I would like a definitive answer from somebody.
No kidding? And I thought people used this list to trade gossip.
> Let me explain what my form is doing. I assume that the dilemma is not
> understood. Basically there is a variable number of classes. The user
> opts to register for the class using a checkbox and then indicates the
> number of seats they wish to purchase. Now what I would love to know
> is how in cake land the association between selected classes and
> number of seats is made for the purpose of forming a query.
>
> Remember the array will have 20 key/values if there are 20 classes
> even if only 3 are selected. Then for the three how do you know the
> proper key/value in the text (no seats) array?
So you need to match up the class checkboxes with the no. of seats
inputs. I'm still not seeing why you're so confused about the use of
$i in a loop.
BTW, have you tried looking at the submitted data? Set debug to 2 in
core.php and:
if (!empty($this-data))
{
die(debug($this->data));
You haven't, in fact, stated that there's an actual problem, aside
from that the code isn't written the way you're used to.
> I think in cake that is called a controller.
A controller is a class. It's what handles a typical request. Perhaps
you meant that the key/values are handed to the controller? That is
correct.
> I would like someone to
> write a routine to accomplish this without reqiring a bunch of string
> manipulation.
http://www.catb.org/~esr/faqs/smart-questions.html
> Has anyone here developed anything not using cake?
I won't be offended by that because 1) I realise that nobody had
clairified why the name[] notation isn't used in Cake; and, 2) with
some of the *other* questions that have been posted here lately, it's
looking like an awful lot of people *do* jump into Cake without any
programming experience at all. ;-)
You still haven't posted:
a) the loop code
b) a description of the models involved and their associations
Perhaps we can get this straightened out for you. Meanwhile, try not
to be so hostile. At least until you've been around for awhile.
--
Our newest site for the community: CakePHP Video Tutorials
http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others
with their CakePHP related questions.
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php