A role to be used in a Form Class:
package MyApp::Form::Test; use HTML::FormHandler::Moose; extends 'HTML::FormHandler'; with 'HTML::FormHandler::Render::RepeatableJs'; ...
This contains one method, 'render_repeatable_js'. It's designed to be used in a template, something like:
[% WRAPPER "wrapper.tt" %] [% form.render_repeatable_js %] <h1>Editing Object .... </h1> [% form.render %] [% END -%]
Some of the extra information (level) in this function is in preparation for handling nested repeatables, but it's not supported yet.
This function operates on HTML elements that have the id of the repeatable element. That requires that the wrapper have the repeatable instance ID (now rendered by default). If you don't have wrappers around your repeatable elements, this won't work.
See HTML::FormHandler::Field::AddElement for an example of rendering an HTML element that can be used to provide the AddElement button. See that field for the requirements for the add HTML.
See HTML::FormHandler::Field::RmElement for an example of rendering an HTML element that can be used to provide a 'remove' button. See that field for the requirements for the remove HTML.
FormHandler Contributors - see HTML::FormHandler
This software is copyright (c) 2013 by Gerda Shank.