Dynamic forms


I have a nested form with Applications and Participants. One application can have many participants. Now I want to be able to dynamically (using JS) add fields for the Participants in the Applications form.

I’m a bit lost on how to do it though… I did watch some videos on RailsCasts (#196, #197) but they seem rather outdated.

I guess I should be able to create some kind of JS-partial that renders only the Participant part of the form and inject it using javascript, the problem would then be, how do I get the form object to the JS… Not possible, right?

So, anyone can give me some tips with this?