Alien-GvaScript

 view release on metacpan or  search on metacpan

lib/Alien/GvaScript/Form.pod  view on Meta::CPAN

then four repetition blocks will automatically created in the form.

[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 add

  GvaScript.Form.add(repeat_name, count);

Creates one or several new repetition blocks.  The parameter C<count>
is optional and defaults to 1.  Focus is automatically given to the
first input element in the last repetition block that has an
C<autofocus> attribute (if any).

See L<Alien::GvaScript::Repeat/add> for more explanations on
the C<add> operation.

=head2 remove

  GvaScript.Form.remove(repeat_block[, live_update]);

Removes a repetition block from the DOM. The argument is either
a DOM element or a string containing the element id.

param C<Boolean> live_update: flag to indicate whether the 'remaining'
repeatable sections are to be also removed from DOM, recreated by re-merging
the data with repeat template, then finally re-appended to the DOM.
Default true.

All repetition blocks above the removed block are renumbered,
leaving no hole in the index sequence. To do so, these
blocks are also removed from the DOM, and then added
again through the L</add> method. This operation is implemented
by L<Alien::GvaScript::Repeat/remove>.

The recreated blocks are then re-populated with their
previous input values.

=head2 autofocus

  GvaScript.Form.autofocus(element);

Inspects DOM children of  C<element>, and gives focus to the 
first child that has an C<autofocus> attribute.

=head1 GvaScript.Forms 

namespace that holds all active instances of GvaScript.Form 

instances are unique per form id

=head2 METHODS 

=head3 get

  GvaScript.Forms.get(id)

finds and returns the GvaScript.Form instance where id is the unique id of the form HTMLElement. 

=head1 GvaScript.Form.Responders

A repository of global listeners notified about every step of the GvaSript.Form lifecycle.

Sometimes, you need to provide generic behaviors over all GvaScript.Form(s) in a single application.

To achieve this, GvaScript.Form provides global Responders that will be executed for every GvaScript.Form instance.

Responders by default are executed B<after> the instance specific event callback.


=head2 METHODS

=head3 register

  GvaScript.Form.Responders.register({eventName: handler}[, {eventName: handler}[, ...]]})

adding one or more global form events responders.

Supported B<eventNames>: C<onInit, onChange, onBeforeSubmit, onSubmit, on[XXX]> where C<on[XXX]> is a custom event name.

=head3 unregister

  GvaScript.Form.Responders.unregister({eventName: handler}[, {eventName: handler}[, ...]]})

unregistering one or more global form events responders.


=head1 GvaScript.Form.EarlyResponders

Identical to GvaScript.Form.Responders except that these responders would be executed B<before> the instance specific callback.



( run in 0.718 second using v1.01-cache-2.11-cpan-8644d7adfcd )