1HTML::FormHandler::RendUesre:r:RCeopnetartiabbulteeHJdTsM(PL3e:)r:lFoDromcHuamnednlteart:i:oRnender::RepeatableJs(3)
2
3
4
6 HTML::FormHandler::Render::RepeatableJs - role providing method to
7 construct repeatable javascript
8
10 version 0.40068
11
13 Creates jQuery javascript to add and delete repeatable elements.
14
15 Note: This is still EXPERIMENTAL. This is an EXAMPLE. Changes are
16 very likely to occur. Javascript is not guaranteed to be best
17 practice. It will not work on all rendered repeatables (requires
18 wrapper with id). It is strongly suggested that you make your own role
19 if you use it. Then you can modify it as needed. Or just write out
20 the rep_ data to javascript variables, and write the function in
21 javascript. This function uses a plain javascript confirmation dialog.
22 You almost certainly want to do something else. This javascript
23 depends on the Repeatable field having a 'controls' div class in order
24 to position the new elements. Use the Bootstrap wrapper or the
25 'controls_div' tag on the Simple wrapper.
26
27 A role to be used in a Form Class:
28
29 package MyApp::Form::Test;
30 use HTML::FormHandler::Moose;
31 extends 'HTML::FormHandler';
32 with 'HTML::FormHandler::Render::RepeatableJs';
33 ...
34
35 DESCRIPTION
36 This contains one method, 'render_repeatable_js'. It's designed to be
37 used in a template, something like:
38
39 [% WRAPPER "wrapper.tt" %]
40 [% form.render_repeatable_js %]
41 <h1>Editing Object .... </h1>
42 [% form.render %]
43 [% END -%]
44
45 It will render javascript which can be used with the AddElement field,
46 and setting the 'setup_for_js' flag in the Repeatable field to add the
47 ability to dynamically add a new repeatable element in a form.
48
49 Note: this code is provided as an example. You may need to write your
50 own javascript function if your situation is different.
51
52 Some of the extra information (level) in this function is in
53 preparation for handling nested repeatables, but it's not supported
54 yet.
55
56 This function operates on HTML elements that have the id of the
57 repeatable element. That requires that the wrapper have the repeatable
58 instance ID (now rendered by default). If you don't have wrappers
59 around your repeatable elements, this won't work.
60
61 See HTML::FormHandler::Field::AddElement for an example of rendering an
62 HTML element that can be used to provide the AddElement button. See
63 that field for the requirements for the add HTML.
64
65 See HTML::FormHandler::Field::RmElement for an example of rendering an
66 HTML element that can be used to provide a 'remove' button. See that
67 field for the requirements for the remove HTML.
68
70 HTML::FormHandler::Render::RepeatableJs
71
73 FormHandler Contributors - see HTML::FormHandler
74
76 This software is copyright (c) 2017 by Gerda Shank.
77
78 This is free software; you can redistribute it and/or modify it under
79 the same terms as the Perl 5 programming language system itself.
80
81
82
83perl v5.32.0 202H0T-M0L7:-:2F8ormHandler::Render::RepeatableJs(3)