HTML::...tableJs(3pm)
hey bestie π welcome to the manual page for HTML::FormHandler::Render::RepeatableJs(3pm) β straight out of the User Contributed Perl Documentation. buckle up, we're doing repeatable javascript with jQuery energy β¨
πΈ NAME πΈ
HTML::FormHandler::Render::RepeatableJs β a role providing method to construct repeatable javascript. periodt. π
β VERSION β
version 0.40068 β yes bestie, that's the number π
β¨ SYNOPSIS β¨
Creates jQuery javascript to add and delete repeatable elements. it's giving dynamic form energy π¦
okay so real talk π«Ά This is still EXPERIMENTAL. This is an EXAMPLE. Changes are very likely to occur. Javascript is not guaranteed to be best practice. It will not work on all rendered repeatables (requires wrapper with id). It is strongly suggested that you make your own role if you use it. Then you can modify it as needed. Or just write out therep_data to javascript variables, and write the function in javascript. This function uses a plain javascript confirmation dialog. You almost certainly want to do something else. This javascript depends on the Repeatable field having a'controls'div class in order to position the new elements. Use the Bootstrap wrapper or the'controls_div'tag on the Simple wrapper.
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';
...
π¦ DESCRIPTION π¦
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 -%]
It will render javascript which can be used with the AddElement field, and setting the setup_for_js flag in the Repeatable field to add the ability to dynamically add a new repeatable element in a form. π«
Note: this code is provided as an example. You may need to write your own javascript function if your situation is different. π
Some of the extra information (level) in this function is in preparation for handling nested repeatables, but it's not supported yet. no cap, nested repeatables are 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. π
π NAME π
HTML::FormHandler::Render::RepeatableJs β that's the whole name, bestie. iconic. π
π AUTHOR π
FormHandler Contributors - see HTML::FormHandler π«Ά
π COPYRIGHT AND LICENSE π
This software is copyright (c) 2017 by Gerda Shank. π
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. βοΈ
okay that's the whole manual page, bestie β mwah π this footer energy is perl v5.34.0, dated 2022-03-25, tagged HTML::...tableJs(3pm), and yes it's this HTML::FormHandler::Render::RepeatableJs(3pm) page. go slay your repeatables β¨
π¦ where this page comes from
- debian bookworm: libhtml-formhandler-perl 0.40068-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libhtml-formhandler-perl 0.40068-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libhtml-formhandler-perl 0.40068-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libhtml-formhandler-perl 0.40068-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms