Here is how the form looks with one existing record (event)... and
then with one newly added to the DOM/HTML (before saving... ) using
jQuery:

<li id="cs_0" class="ui-state-default">
<span class="ui-icon ui-icon-arrowthick-2-n-s"></span>
<div class="input text">
<input type="text" id="Event0Title" value="First Session"
maxlength="255" name="data[Event][0][title]">
</div>
<div class="input textarea">
<textarea id="Event0Description" rows="5" cols="30" name="data[Event]
[0][description]">This is the first event.</textarea>
</div>
<div class="item_id">
<input type="hidden" id="Event0Id" value="1" name="data[Event][0]
[id]">
</div>
</li>


<li class="ui-state-default" id="cs_1">
<span class="ui-icon ui-icon-arrowthick-2-n-s"></span>
<div class="input text">
<input type="text" id="Event1Title" value="First Session"
maxlength="255" name="data[Event][1][title]">
</div>
<div class="input textarea">
<textarea id="Event1Description" rows="5" cols="30" name="data[Event]
[1][description]">This is the first event.</textarea>
</div>
<div class="item_id"></div>
</li>


I have it just clone an existing form input section and replace the
fields with a new id (using numbers... 1, 2, 3...) so it appears to
have the same name and id form fields as the fields that do get saved.

I was under the same impression (and still am,) as your comment about
the automagic action of the form and saving happening after the form
is finally sent... but somehow it's not picking up these new form
fields.

I've checked to make sure that the fields are indeed within the same
<UL> tag just in case that made a difference.  It seems like some tiny
little issue is causing this to happen... but I still can't quite find
it.

I noticed that you wrote about how the field name format is
data['Event'][1]['fieldname']  with those single quote marks
included.  In my form, the format without single quotes seems to be
working for the existing entries... but for the newly added (DOM/HTML)
fields, no success.  Do you know if those single quotes matter in this
case?  Thanks,

Andy



Thanks again for your help.

On Feb 16, 12:36 am, WebbedIT <p...@webbedit.co.uk> wrote:
> In your first two representations of your data array there was no
> second event.  As long as the fields you are inserting for the 2nd
> event follow the data['Event'][1]['fieldname'] format then it should
> all be ok.
>
> I'm confident that you should be able to submit a form that has been
> built dynamically as all the automagic happens after you submit the
> form, the only thing that would have a problem with the form would be
> the security component if you were using it, but that would reject the
> form all together and give you a white screen.
>
> If you are truly following the data['Event'][1]['fieldname'] format it
> should work fine, concentrate solely on getting the right data array
> to the contrlller and the rest should fall into place.
>
> Paul.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to