Re: Using saveAll to insert new fields, update old fields
Often you can get so hung up on thinking the problem is with Cake that you forget to thoroughly check your HTML. Been guilty of this myself, glad you found it :) 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
Re: Using saveAll to insert new fields, update old fields
For future reference for anyone else having the same issue... it turns out that the current HTML tag has a certain scope that needs to be within the same (or within the same,) . I ended up having one tag inside of a ... and then had the ending tag outside of the . 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
Re: Using saveAll to insert new fields, update old fields
It turned out that at some point in my Javascript I'm appending the new fields outside of the ... I thought I had checked that before... and I was checking the DOM via Firebug in Firefox. But apparently Firebug (or Firefox,) seems to show and as on the same line... even though I purposely put the closing tag at the very end of my generated HTML (and verified by viewing the generated HTML source.) Thanks for the help anyway. I should have realized I was appending outside of the tags. Andy On Feb 17, 1:57 am, WebbedIT wrote: > No, you do not need the single quotes within the fields name, that is > how I would access the value from the data array. Sorry for any > confusion. > > As you rightly say, your form looks exactly as it should so confusing > as to why it refuses to process the dynamic fields? > > Unfortunately I do not have the time to set up a test case to try and > resolve this for you :( > > 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
Re: Using saveAll to insert new fields, update old fields
I wonder if this could be a partial caching issue with the view... - Any fields in the form at first page view will save. - Any fields added via jQuery after first page view are not saved. Does anyone know if CakePHP partially caches a form (view) the first time it is loaded? 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
Re: Using saveAll to insert new fields, update old fields
No worries about a test case :-) I'll just keep testing different parts of it until something works... it seems like it should work but maybe I am forgetting something. Thanks for your help anyway. Andy On Feb 17, 1:57 am, WebbedIT wrote: > No, you do not need the single quotes within the fields name, that is > how I would access the value from the data array. Sorry for any > confusion. > > As you rightly say, your form looks exactly as it should so confusing > as to why it refuses to process the dynamic fields? > > Unfortunately I do not have the time to set up a test case to try and > resolve this for you :( > > 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
Re: Using saveAll to insert new fields, update old fields
No, you do not need the single quotes within the fields name, that is how I would access the value from the data array. Sorry for any confusion. As you rightly say, your form looks exactly as it should so confusing as to why it refuses to process the dynamic fields? Unfortunately I do not have the time to set up a test case to try and resolve this for you :( 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
Re: Using saveAll to insert new fields, update old fields
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: This is the first event. This is the first event. 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 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 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
Re: Using saveAll to insert new fields, update old fields
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
Re: Using saveAll to insert new fields, update old fields
But I am wanting to use jQuery/Javascript to dynamically add a new form item before saving... I'll keep poking around with it but I am still curious as to if there is a limitation on form-creation with CakePHP... On Feb 15, 12:40 pm, andy wrote: > It appears to work when I manually put in a new input form field into > the view... instead of having it being added via jQuery: > > [data] => Array > ( > [Event] => Array > ( > [0] => Array > ( > [title] => First Event > [description] => This is the first event. > [weight] => 1 > [id] => 1 > ) > > [1] => Array > ( > [title] => second > [description] => second event > [weight] => > ) > > ) > > [Schedule] => Array > ( > [title] => First Schedule > [description] => This is the first schedule. > [id] => 1 > ) > > ) > > Is there some type of limitation on when something can be added to a > form in CakePHP before the form is saved/sent? > > On Feb 14, 1:00 am, WebbedIT wrote: > > > > > Paste a copy of the data array that is getting to your controller > > after a form submit and someone will advise if it's structured > > correctly > > > HTH > > > 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
Re: Using saveAll to insert new fields, update old fields
It appears to work when I manually put in a new input form field into the view... instead of having it being added via jQuery: [data] => Array ( [Event] => Array ( [0] => Array ( [title] => First Event [description] => This is the first event. [weight] => 1 [id] => 1 ) [1] => Array ( [title] => second [description] => second event [weight] => ) ) [Schedule] => Array ( [title] => First Schedule [description] => This is the first schedule. [id] => 1 ) ) Is there some type of limitation on when something can be added to a form in CakePHP before the form is saved/sent? On Feb 14, 1:00 am, WebbedIT wrote: > Paste a copy of the data array that is getting to your controller > after a form submit and someone will advise if it's structured > correctly > > HTH > > 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
Re: Using saveAll to insert new fields, update old fields
Also, if it helps... here is the HTML output of a newly-added form "event" added to the HTML... before saving with CakePHP: Title Description Weight On Feb 14, 1:00 am, WebbedIT wrote: > Paste a copy of the data array that is getting to your controller > after a form submit and someone will advise if it's structured > correctly > > HTH > > 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
Re: Using saveAll to insert new fields, update old fields
Sorry, that array actually should look like this (I had previously commented out something...) Array ( [Event] => Array ( [0] => Array ( [title] => First Event [description] => This is the first event. [weight] => 1 [id] => 1 ) ) [Schedule] => Array ( [title] => First Schedule [description] => This is the first schedule. [id] => 1 ) ) On Feb 14, 1:00 am, WebbedIT wrote: > Paste a copy of the data array that is getting to your controller > after a form submit and someone will advise if it's structured > correctly > > HTH > > 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
Re: Using saveAll to insert new fields, update old fields
Array ( [Event] => Array ( [0] => Array ( [title] => First Event [description] => This is the first event. [weight] => 1 ) ) [Schedule] => Array ( [title] => First Schedule [description] => This is the first schedule. [id] => 1 ) ) The problem appears to be that I'm not even getting an array item for the newly-added event (added via jQuery to the DOM/HTML before saving in CakePHP.) Has anyone tried dynamically adding something to a form in the HTML before saving? When I add a new event... I'm purposely not putting a new id in the UL's LI for that new "event" item. The id should be added automatically in my database and it would most likely be a different number. Thanks, Andy On Feb 14, 1:00 am, WebbedIT wrote: > Paste a copy of the data array that is getting to your controller > after a form submit and someone will advise if it's structured > correctly > > HTH > > 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
Re: Using saveAll to insert new fields, update old fields
Paste a copy of the data array that is getting to your controller after a form submit and someone will advise if it's structured correctly HTH 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