Thanks for your input. The overhead for each request could be a killer if I start building a very fragmented ajax-heavy interface.
I have started testing a small prototype interface. The initial page is loaded containing invisible "templates" for letting javascript add new form data (there are several types of rules formatted differently) by simply copying a new template for each new rule. Like you say, on submit I have to tweak the form data a bit to get the cake-friendly data-object on the server but it works. On Dec 18, 5:52 pm, Andrew Assarattanakul <[EMAIL PROTECTED]> wrote: > I've written a form that allowed to create/delete multiple records > from a table only when it was saved. > > The best solution that I could find was to do a big post and build the > form so that all of it can be passed to the save function for cake, > but had to manipulate the data and saved each part one at a time. This > creates less traffic between the client and the server. > > Now if you were automatically saving each value then I probably would > have saved each rule as they were completed because sending all of the > data each time would be wasting bandwidth when little parts of it was > being changed at a time. > > On Dec 17, 3:43 pm, "[EMAIL PROTECTED]" > > <[EMAIL PROTECTED]> wrote: > > Hi everyone, > > I am in the early stages of a new app and like doing more > > headscratching than coding at this point. I am looking for opinions or > > links to blog-posts that deal with the following: > > > The short version: > > When an interface with lots of ajax will finally submit a "new" item > > consisting of multiple records in related models. What is preferable? > > One big multi-post (whith added behaviour to save the related records) > > from a single form... or many ajax-posts with one "form" per record... > > or something else entirely I haven't thought of? > > > I have only used AJAX in a small way before and the game changes a bit > > when the application is "driven" by ajax. > > Any good resources on Ajax-related strategies you would recommend? > > Specifically server-client stuff that affects Cake (1.2). > > > The slightly longer version with a few details: > > > A section of this new app will focus on creating a filter (think Mac > > OS X find dialog or a firewall editor). The user will edit a filter > > (adding several rules) until he/she is happy and then save it. Exiting > > the editor before saving should not leave any data. I don't want to > > create new records one at a time during editing. I think it will be > > less obvious to the user if any changes were always saved. > > > So at some point the user will have a FIlter with a number of Rules > > (FIlter hasMany Rules) that should all be saved. I can go down the > > path of the big post and add some functionality to the AppModel (or a > > behaviour for 1.2) that will save the related Rules (hasMany is not > > part of "the magic" AFAIK). But this may be unnecessary since Ajax is > > already being used for the editor, ajax could just take care of the > > saving using one post for each item in the editor. More Javascript of > > more PHP? > > > I can imagine there being some logical gotcha being the reason hasMany > > relationships do not auto-save like HABTM-ones do. I just haven't > > thought that through yet I guess. > > > That's it. > > Any opinions or links will be appreciated. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---
