On Sat, Dec 18, 2010 at 7:48 AM, cake-learner <sh.koiz...@gmail.com> wrote: > I am trying to design the form like this. > > http://skoizumi.com/cakephp/complicated-form.gif > > > you can add categories to a survey, add questions to a category, and > add selection values to a question. > > I saw some of documents where you can define the array of records by > using classname and index with dot > ( category.0.question ), but it stops working after a couple dots. Is > there anyway to create this form with formhelp class or i should just > do it manually?
If this is an admin situation only, I recommend considering using AJAX to build things in pieces. Especially if you're using something like JQuery. I've done this several times and it's worked very well for me. The idea is, you start with a basic form to create a new Survey. Submit that (check out the JQuery form plugin) and have Cake echo back the Form.id. The 'success' callback of the AJAX submit then stores the id locally (using JQuery's data functionality, or simply added to some hidden DOM element) and changes, eg. the Survey.name form element into an h2 header (or whatever). Finally, the callback displays another form for adding a Category, which includes a hidden element for Category.survey_id whose value is that returned id. This form is also submitted with AJAX. When the new Category is created, though, instead of removing its form, the returned Category.id is added to the form as a hidden element. This way, the Category name or whatever else can be edited at any time. Meanwhile, a new form is created for adding a question, also with its own hidden element for Question.category_id. And so on. I have no idea how to do any of this with Cake's JQuery helper, though. I prefer to handle all of that sort of stuff in JS. 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