The form-builder manages multiple and multiple data relationships and dynamic inputs?

advertisements

I'm experimenting with Dancer some time, and looking for the right blocks to build my application. Frameworks tend to have flat example applications, dealing with one table at time. So I have no good idea which tools should be used to build a little bit more complex CRUD forms.

Let's say I create a Booklovers app. It should have a form to add/edit books with authors. To cover this I need 3 tables in our database: books, authors and books_to_authors. Which is best way to build a form to add a book with authors?

Note:

  • It is not known how many authors a book may have, we need dynamic adding of rows.
  • The authors table may have tens of thousands of records, so a select form element is not suitable.
  • An author may be missing from our database, we need to add them dynamically, too.

All these dynamic parts needs some AJAX. Is there a good solution to integrate it with form creating tools in Perl? I looked at CGI::FormBuilder and am still looking, but I did not find something that could build forms for 3 joined tables as described. The dynamic client-side part also still needs to be covered.

Are there some best practices for such a pretty simple case?


AJAX is for rendering data in a Web browser, it doesn't affect the back-end data storage.

The books and authors tables have a many-to-many relationship, using ORMs such as DBIx-Class can help.

In the Web form, there is a new book and a collection of authors. At the server side, create a book, then add authors to book.

Browse the DBIx::Class cookbook to get some ideas.

Sorry for not providing a simple answer to solve your problem.