Re: having trouble with post on inherited cake project
Basically if I remove the $i from the input in cake it renders all the
inputs the same name, or key if you will, I do not need to get rid of
the loop. I do not know the length of the loop as it is variable. I
will attach again what I have with cake and a snippet from a regular
php project that show what I need to do.
This is cake->
echo $form->checkbox('OnsiteTrainingClass.select_class'.
$i,array('id'=>'select'.$i,'label'=>'','value'=>
$value['OnsiteTrainingClass']['id']));
echo $form->text('OnsiteTrainingClass.seats'.
$classid,array('id'=>'select'.
$i,'label'=>'','value'=>'1','size'=>'2'));
I need->
<tr><td><input type="text" size="27" maxlength="50" name="name[]"
value="<?php if($attendees[0] != ""){echo $attendees[0];}?>"><input
type="text" size="27" maxlength="50" name="title[]" value="<?php
if($title[0] != ""){echo $title[0];}?>"></td></tr>
This allows an undetermined number of inputs to be stored into the
post array dynamically. I the example it allows me to collect name and
title withuot knowing or caring how many are provided. I get name[0]
and the title that goes with that is title[0]. It it a thing of beauty
but cake will not allow met to set my input above to
OnsiteTrainingClass[]. I am not sure what the error is, suffice it to
say cake is not allowing this. I was hoping that those who are
proficient with cake might be able to tell me if there is a
workaround. A way to dynamically create keys like regular php.
On Feb 19, 2:07 pm, kdubya <kenwin...@winanstech.com> wrote:
> Thomas,
>
> Please show us a bit more of the code surrounding the snippet with the
> checkbox. Also, what do you mean by "it hoses everything up?" Do you
> get error messages?
>
> It appears the original code snippet you show was in a loop. Why do
> you want to get rid of the loop?
>
> Ken
--
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
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home