Alien-GvaScript
view release on metacpan or search on metacpan
doc/html/Form.html view on Meta::CPAN
</div>
</div>
<div class="TN_node" id="to_tree">
<h3 class="TN_label">to_tree</h3>
<div class="TN_content">
<pre> var tree = GvaScript.Form.to_tree(form);</pre>
<p>Inspects the contents of all fields in <code>form</code> and
returns a data tree, were dotted names in form names
are expanded into sub-arrays or sub-hashes. So for example
if the form looks like</p>
<pre> <input name="father.firstname"> <input name="father.lastname"><br>
<input name="mother.firstname"> <input name="mother.lastname"><br>
<div repeat="child" repeat-start="1">
<input name="#{child.path}.firstname"><br>
</div></pre>
<p>and if that form has been expanded with 3 repetition blocks
for children, the resulting tree would be</p>
<pre> { "father" : {"firstname" : ..., "lastname": ...},
"mother" : {"firstname" : ..., "lastname": ...},
doc/html/Repeat.html view on Meta::CPAN
<h3 class="TN_label">add</h3>
<div class="TN_content">
<pre> GvaScript.Repeat.add(repeat_name, count)</pre>
<p>Creates one or several new repetition blocks in the DOM,
after the current blocks, by instanciating
the repeat element <code>repeat_name</code> (including prefix).
The <code>count</code> argument is optional and states how many blocks
should be added; default is 1. Returns the final number of
repetition blocks for that repeat element.</p>
<p>If the repeat structure looks like</p>
<pre> <div repeat="foo" repeat-prefix="top">
<div repeat="bar"></pre>
<p>then a new <code>foo</code> repetition block is instanciated
through <code>add('top.foo')</code>, and a new <code>bar</code> repetition
block is instanciated through <code>add('#{foo.path}.bar')</code>.</p>
</div>
</div>
<div class="TN_node" id="remove">
lib/Alien/GvaScript/Form.pod view on Meta::CPAN
[I<This method can be called either as an instance method or as a generic method. If calling as a generic, pass the form HTMLElement/id in as the first argument.>]
=head2 to_tree
var tree = GvaScript.Form.to_tree(form);
Inspects the contents of all fields in C<form> and
returns a data tree, were dotted names in form names
are expanded into sub-arrays or sub-hashes. So for example
if the form looks like
<input name="father.firstname"> <input name="father.lastname"><br>
<input name="mother.firstname"> <input name="mother.lastname"><br>
<div repeat="child" repeat-start="1">
<input name="#{child.path}.firstname"><br>
</div>
and if that form has been expanded with 3 repetition blocks
for children, the resulting tree would be
lib/Alien/GvaScript/Repeat.pod view on Meta::CPAN
GvaScript.Repeat.add(repeat_name, count)
Creates one or several new repetition blocks in the DOM,
after the current blocks, by instanciating
the repeat element C<repeat_name> (including prefix).
The C<count> argument is optional and states how many blocks
should be added; default is 1. Returns the final number of
repetition blocks for that repeat element.
If the repeat structure looks like
<div repeat="foo" repeat-prefix="top">
<div repeat="bar">
then a new C<foo> repetition block is instanciated
through C<add('top.foo')>, and a new C<bar> repetition
block is instanciated through C<add('#{foo.path}.bar')>.
( run in 0.346 second using v1.01-cache-2.11-cpan-64827b87656 )