Jifty::Web::Form::Element - Some item that can be rendered in a form
Describes any HTML element that might live in a form, and thus might have javascript on it.
Handlers are placed on Jifty::Web::Form::Element objects by calling the name of the javascript event handler, such as onclick, with a set of arguments.
onclick
The format of the arguments passed to onclick (or any similar method) is a hash reference or string Strings are inserted verbatim.
Hash references can take a number of possible keys. The most important is the mode of the fragment replacement, if any; it is specified by providing at most one of the following keys:
Add the given PATH as a new fragment, just before the close of the CSS selector given by "element", which defaults to the end of the current region.
PATH
Add the given PATH as a new fragment, just after the start of the CSS selector given by "element", which defaults to the start of the current region.
Replaces the region specified by the region parameter (which defaults to the current region) with the fragment located at the given PATH. If undef is passed as the PATH, acts like a "delete".
region
undef
Refreshes the given REGION, which should be a Jifty::Web::PageRegion object, or the fully qualified name of such.
REGION
Refreshes the current region; this is the default action, if a non-empty args is supplied, but no other mode is given.
args
Removes the given REGION from the page, permanently.
The following options are also supported:
If set to true, then the link will possibly toggle the region to empty, if the region's current path is the same as the path the region is trying to be set to.
The region that should be updated. This defaults to the current region.
A css selector specifying where the new region should be placed; used with "append" and "prepend", above. The "get_element" in Jifty::Web::PageRegion method may be useful in specifying elements of parent page regions.
An action, moniker of an action, or array reference to such; these actions are submitted when the event is fired.
Arguments to the region. These will override the arguments to the region that the region was given when it was last rendered.
The Prototype visual effect to use when updating or creating the fragment.
A hashref of arguments to pass to the effect when it is created. These can be used to change the duration of the effect, for instance.
Currently, the only supported event handlers are onclick. WARNING: if you use the onclick handler, make sure that your javascript is "return (function name);", or you may well get a very strange-looking error from your browser.
Any descendant of Jifty::Web::Form::Element should be able to accept any of the event handlers (above) as one of the keys to its new parameter hash.
new
Returns the javascript necessary to make the events happen.
Returns true if the the javascript's handlers should prevent the web browser's standard effects from happening; that is, for onclick, it prevents buttons from submitting and the like. The default is to return true, but this can be overridden.
Sets the CSS class that the element will display as
Sets the key binding associated with this elements
Subclasses must override this to provide each element with a unique id.
Sets the label of the element. This will be used for the key binding legend, at very least.
Adds the key binding for this input, if one exists.
To install Jifty, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Jifty
CPAN shell
perl -MCPAN -e shell install Jifty
For more information on module installation, please visit the detailed CPAN module installation guide.