.\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.16) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .ie \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} .el \{\ . de IX .. .\} .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "Jifty::Web::Form::Element 3pm" .TH Jifty::Web::Form::Element 3pm "2011-04-25" "perl v5.14.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Jifty::Web::Form::Element \- Some item that can be rendered in a form .SH "DESCRIPTION" .IX Header "DESCRIPTION" Describes any \s-1HTML\s0 element that might live in a form, and thus might have javascript on it. .PP Handlers are placed on Jifty::Web::Form::Element objects by calling the name of the javascript event handler, such as \f(CW\*(C`onclick\*(C'\fR or \f(CW\*(C`onchange\*(C'\fR, with a set of arguments. .PP The format of the arguments passed to \f(CW\*(C`onclick\*(C'\fR (or any similar method) is a string, a hash reference, or a reference to an array of multiple hash references. Strings are inserted verbatim. .PP 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: .IP "append => \s-1PATH\s0" 4 .IX Item "append => PATH" Add the given \f(CW\*(C`PATH\*(C'\fR as a new fragment, just before the close of the \&\s-1CSS\s0 selector given by \*(L"element\*(R", which defaults to the end of the current region. .IP "prepend => \s-1PATH\s0" 4 .IX Item "prepend => PATH" Add the given \f(CW\*(C`PATH\*(C'\fR as a new fragment, just after the start of the \&\s-1CSS\s0 selector given by \*(L"element\*(R", which defaults to the start of the current region. .IP "popout => \s-1PATH\s0" 4 .IX Item "popout => PATH" Displays the given \f(CW\*(C`PATH\*(C'\fR as a new fragment in a lightbox-style popout. .IP "replace_with => \s-1PATH\s0" 4 .IX Item "replace_with => PATH" Replaces the region specified by the \f(CW\*(C`region\*(C'\fR parameter (which defaults to the current region) with the fragment located at the given \&\f(CW\*(C`PATH\*(C'\fR. If \f(CW\*(C`undef\*(C'\fR is passed as the \f(CW\*(C`PATH\*(C'\fR, acts like a \*(L"delete\*(R". .IP "refresh => \s-1REGION\s0" 4 .IX Item "refresh => REGION" Refreshes the given \f(CW\*(C`REGION\*(C'\fR, which should be a Jifty::Web::PageRegion object, or the fully qualified name of such. .IP "refresh_self => 1" 4 .IX Item "refresh_self => 1" Refreshes the current region; this is the default action, if a non-empty \f(CW\*(C`args\*(C'\fR is supplied, but no other mode is given. .IP "delete => \s-1REGION\s0" 4 .IX Item "delete => REGION" Removes the given \f(CW\*(C`REGION\*(C'\fR from the page, permanently. .PP The following options are also supported: .IP "toggle => \s-1BOOLEAN\s0" 4 .IX Item "toggle => BOOLEAN" 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. .IP "region => \s-1REGION\s0" 4 .IX Item "region => REGION" The region that should be updated. This defaults to the current region. .IP "element => \s-1CSS\s0 \s-1SELECTOR\s0" 4 .IX Item "element => CSS SELECTOR" A css selector specifying where the new region should be placed; used with \*(L"append\*(R" and \*(L"prepend\*(R", above. The \&\*(L"get_element\*(R" in Jifty::Web::PageRegion method may be useful in specifying elements of parent page regions. .IP "submit => \s-1MONIKER\s0" 4 .IX Item "submit => MONIKER" A Jifty::Action, Jifty::Action moniker, hashref of { action => Jifty::Action::Subclass, arguments => { argument => value, argument2 => value2 } .Sp or an arrayref of them. .Sp These actions are submitted when the event is fired. Any arguments specified will override arguments submitted by form field. .Sp If you explicitly pass \f(CW\*(C`undef\*(C'\fR, then all actions will be submitted. This can be useful in conjunction with an \f(CW\*(C`onclick\*(C'\fR handler, since declaring an \f(CW\*(C`onclick\*(C'\fR handler intentionally turns off action submission. .IP "disable => \s-1BOOLEAN\s0" 4 .IX Item "disable => BOOLEAN" If true, disable all form fields associated with the actions in \&\f(CW\*(C`submit\*(C'\fR when this Element is clicked. This serves to give immediate visual indication that the request is being processed, as well as to prevent double-submits. .Sp Defaults to true. .IP "args => \s-1HASHREF\s0" 4 .IX Item "args => HASHREF" Arguments to the region. These will override the arguments to the region that the region was given when it was last rendered. .IP "effect => \s-1STRING\s0" 4 .IX Item "effect => STRING" The Scriptaculous or jQuery visual effect to use when updating or creating the fragment. .IP "effect_args => \s-1HASHREF\s0" 4 .IX Item "effect_args => HASHREF" 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. .IP "remove_effect => \s-1STRING\s0" 4 .IX Item "remove_effect => STRING" As \f(CW\*(C`effect\*(C'\fR, but for when the previous version of the region is removed. .IP "remove_effect_args => \s-1HASHREF\s0" 4 .IX Item "remove_effect_args => HASHREF" As \f(CW\*(C`effect_args\*(C'\fR, but for \f(CW\*(C`remove_effect\*(C'\fR. .IP "beforeclick => \s-1STRING\s0" 4 .IX Item "beforeclick => STRING" String contains some Javascript code to be used before a click. .IP "confirm => \s-1STRING\s0" 4 .IX Item "confirm => STRING" Prompt the user with a Javascript confirm dialog with the given text before carrying out the rest of the handlers. If the user cancels, do nothing, otherwise proceed as normal. .Sp \&\s-1TODO:\s0 This does not have a non-Javascript fallback method yet. .SS "handlers" .IX Subsection "handlers" The following handlers are supported: .PP onclick onchange ondblclick onmousedown onmouseup onmouseover onmousemove onmouseout onfocus onblur onkeypress onkeydown onkeyup onselect .PP \&\s-1NOTE:\s0 onload, onunload, onsubmit and onreset are not yet supported .PP \&\s-1WARNING:\s0 if you use the onclick handler, make sure that your javascript is \*(L"return (function name);\*(R", or you may well get a very strange-looking error from your browser. .SS "accessors" .IX Subsection "accessors" 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 \&\f(CW\*(C`new\*(C'\fR parameter hash. .SS "new \s-1PARAMHASH\s0 \s-1OVERRIDE\s0" .IX Subsection "new PARAMHASH OVERRIDE" Create a new \f(CW\*(C`Jifty::Web::Form::Element\*(C'\fR object blessed with \&\s-1PARAMHASH\s0, and set with accessors for the hash values in \s-1OVERRIDE\s0. .SS "onclick" .IX Subsection "onclick" The onclick event occurs when the pointing device button is clicked over an element. This attribute may be used with most elements. .SS "onchange" .IX Subsection "onchange" The onchange event occurs when a control loses the input focus and its value has been modified since gaining focus. This handler can be used with all form elements. .SS "ondblclick" .IX Subsection "ondblclick" The ondblclick event occurs when the pointing device button is double clicked over an element. This handler can be used with all form elements. .SS "onmousedown" .IX Subsection "onmousedown" The onmousedown event occurs when the pointing device button is pressed over an element. This handler can be used with all form elements. .SS "onmouseup" .IX Subsection "onmouseup" The onmouseup event occurs when the pointing device button is released over an element. This handler can be used with all form elements. .SS "onmouseover" .IX Subsection "onmouseover" The onmouseover event occurs when the pointing device is moved onto an element. This handler can be used with all form elements. .SS "onmousemove" .IX Subsection "onmousemove" The onmousemove event occurs when the pointing device is moved while it is over an element. This handler can be used with all form elements. .SS "onmouseout" .IX Subsection "onmouseout" The onmouseout event occurs when the pointing device is moved away from an element. This handler can be used with all form elements. .SS "onfocus" .IX Subsection "onfocus" The onfocus event occurs when an element receives focus either by the pointing device or by tabbing navigation. This handler can be used with all form elements. .SS "onblur" .IX Subsection "onblur" The onblur event occurs when an element loses focus either by the pointing device or by tabbing navigation. This handler can be used with all form elements. .SS "onkeypress" .IX Subsection "onkeypress" The onkeypress event occurs when a key is pressed and released over an element. This handler can be used with all form elements. .SS "onkeydown" .IX Subsection "onkeydown" The onkeydown event occurs when a key is pressed down over an element. This handler can be used with all form elements. .SS "onkeyup" .IX Subsection "onkeyup" The onkeyup event occurs when a key is released over an element. This handler can be used with all form elements. .SS "onselect" .IX Subsection "onselect" The onselect event occurs when a user selects some text in a text field. This attribute may be used with the text and textarea fields. .SS "_handler_setup" .IX Subsection "_handler_setup" This method is used by all handlers to normalize all arguments. .SS "handlers_used" .IX Subsection "handlers_used" Returns the names of javascript handlers which exist for this element. .SS "javascript" .IX Subsection "javascript" Returns the javascript necessary to make the events happen, as a string of \s-1HTML\s0 attributes. .SS "javascript_attrs" .IX Subsection "javascript_attrs" Returns the javascript necessary to make the events happen, as a hash of attribute-name and value. .SS "javascript_preempt" .IX Subsection "javascript_preempt" Returns true if the the javascript's handlers should prevent the web browser's standard effects from happening; that is, for \f(CW\*(C`onclick\*(C'\fR, it prevents buttons from submitting and the like. The default is to return true, but this can be overridden. .SS "class" .IX Subsection "class" Sets the \s-1CSS\s0 class that the element will display as .SS "title" .IX Subsection "title" Sets the title that the element will display, e.g. for tooltips .SS "key_binding" .IX Subsection "key_binding" Sets the key binding associated with this element .SS "key_binding_label" .IX Subsection "key_binding_label" Sets the key binding label associated with this element (if none is specified, the normal label is used instead) .SS "id" .IX Subsection "id" Subclasses must override this to provide each element with a unique id. .SS "label" .IX Subsection "label" Sets the label of the element. This will be used for the key binding legend if key_binding_label is not set. .SS "key_binding_javascript" .IX Subsection "key_binding_javascript" Returns the javascript fragment to add key binding for this input, if one exists. .SS "render_key_binding" .IX Subsection "render_key_binding" Renders the javascript from \*(L"key_binding_javscript\*(R" in a