On Dec 21, 3:36 pm, iKs <[email protected]> wrote: [...] > First of all, we can have from 0 to inf coprofessors and TAs. > Therefore I need to be able to add fields to my form dynamically. I > know it is possible through pure Javascript with DOM but most websites > and books about Rails tend to tell me to use AJAX and partials. I feel > it's plain stupid to recontact the server just to add a blank <input />.
I would agree with you. The only advantage of recontacting the server is that you can have it spit out a new copy of a partial -- and reinterpret the ERb each time. But judicious use of cloneNode in JS should work just as well. > What is the best way? I also need it to work when Javascript is > disabled. Should I use a plain HTML version only that uses one form to > add TAs or coprofessors one at a time? That's a usability decision best left to you and your users. > > Second I'm not sure if my usage of form_for and fields_for is the > wisest one. For now, I have one big form (still OK to use I feel) with > infos about TAs, coprofessors, periods, places, etc. all in one place. > In the back-end of course they are different models so I use a > form_for Course and several fields_for (in partials). Should I instead > separate it in several pages/views with form_fors in each of them? > What the "Railser" way to do it? Again, use whatever UI will be best for your users. It's perfectly OK to use lots of fields_for to get different models onto one form if that's what the UI calls for. > > Thank you for your help and time! > > -Max Best, -- Marnen Laibow-Koser [email protected] http://www.marnen.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" 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/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

