Hi guys I’m pretty stuck with building a customised form in active admin. I’ve figured out and even set up my own customised forms using active admin. However I need to create a dynamic form here. This involves making some ajax calls and returning partials of a form for the user to fill out.
It seems that you can create a member action but that is on resources that have been created. In my case I need to create multiple entries on a resource that is yet to be created.
This might get you started. A way could be to add your ajax route to config.routes (just some random example code):
Then in the correct register block, in this case in app/admin/articles.rb you can put your controller logic
In this case the template just renders an unordered list to be put in the form. Located at app/views/admin/authors/search.html.erb and looks like:
Your custom jquery to trigger the ajax-call could look like this, here a delayedObserver is used (thanks to http://code.google.com/p/jquery-utils/wiki/DelayedObserver ):
Anything is possible. Just analyze what you really need: form partials, nested form partials? Depending selects? Maybe you want to build a multiple step form instead. Good luck.