.\" Automatically generated by Pod::Man 2.27 (Pod::Simple 3.28) .\" .\" 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" '' . ds C` . ds C' '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. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{ . if \nF \{ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" 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 "HTML::Widget::Result 3pm" .TH HTML::Widget::Result 3pm "2007-03-01" "perl v5.18.1" "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" HTML::Widget::Result \- Result Class .SH "SYNOPSIS" .IX Header "SYNOPSIS" see HTML::Widget .SH "DESCRIPTION" .IX Header "DESCRIPTION" Result Class. .SH "METHODS" .IX Header "METHODS" .SS "action" .IX Subsection "action" Arguments: \f(CW$action\fR .PP Return Value: \f(CW$action\fR .PP Contains the form action. .SS "as_xml" .IX Subsection "as_xml" Return Value: \f(CW$xml\fR .PP Returns xml. .SS "container" .IX Subsection "container" Arguments: \f(CW$tag\fR .PP Return Value: \f(CW$tag\fR .PP Contains the container tag. .SS "enctype" .IX Subsection "enctype" Arguments: \f(CW$enctype\fR .PP Return Value: \f(CW$enctype\fR .PP Contains the form encoding type. .SS "errors" .IX Subsection "errors" .SS "error" .IX Subsection "error" Arguments: \f(CW$name\fR, \f(CW$type\fR .PP Return Value: \f(CW@errors\fR .PP Returns a list of HTML::Widget::Error objects. .PP .Vb 3 \& my @errors = $form\->errors; \& my @errors = $form\->errors(\*(Aqfoo\*(Aq); \& my @errors = $form\->errors( \*(Aqfoo\*(Aq, \*(AqASCII\*(Aq ); .Ve .PP \&\*(L"error\*(R" is an alias for \*(L"errors\*(R". .SS "elements" .IX Subsection "elements" .SS "element" .IX Subsection "element" Arguments: \f(CW$name\fR (optional) .PP Return Value: \f(CW@elements\fR .PP If \f(CW$name\fR argument is supplied, returns a HTML::Widget::Container object for the first element matching \f(CW$name\fR. Otherwise, returns a list of HTML::Widget::Container objects for all elements. .PP .Vb 2 \& my @form = $f\->elements; \& my $age = $f\->elements(\*(Aqage\*(Aq); .Ve .PP \&\*(L"element\*(R" is an alias for \*(L"elements\*(R". .SS "elements_ref" .IX Subsection "elements_ref" Arguments: \f(CW$name\fR (optional) .PP Return Value: \e@elements .PP Accepts the same arguments as \*(L"elements\*(R", but returns an arrayref of results instead of a list. .SS "find_result_element" .IX Subsection "find_result_element" Arguments: \f(CW$name\fR .PP Return Value: \f(CW@elements\fR .PP Looks for the named element and returns a HTML::Widget::Container object for it if found. .SS "elements_for" .IX Subsection "elements_for" Arguments: \f(CW$name\fR .PP Return Value: \f(CW@elements\fR .PP If the named element is a Block or NullContainer element, return a list of HTML::Widget::Container objects for the contents of that element. .SS "find_elements" .IX Subsection "find_elements" Return Value: \f(CW@elements\fR .PP Exactly the same as \*(L"find_elements\*(R" in HTML::Widget .SS "empty_errors" .IX Subsection "empty_errors" Arguments: \f(CW$bool\fR .PP Return Value: \f(CW$bool\fR .PP Create spans for errors even when there's no errors.. (For \s-1AJAX\s0 validation validation) .SS "has_errors" .IX Subsection "has_errors" .SS "has_error" .IX Subsection "has_error" .SS "have_errors" .IX Subsection "have_errors" Arguments: \f(CW$name\fR .PP Return Value: \f(CW$bool\fR .PP Returns a list of element names. .PP .Vb 2 \& my @names = $form\->has_errors; \& my $error = $form\->has_errors($name); .Ve .PP \&\*(L"has_error\*(R" and \*(L"have_errors\*(R" are aliases for \*(L"has_errors\*(R". .SS "id" .IX Subsection "id" Arguments: \f(CW$id\fR .PP Return Value: \f(CW$id\fR .PP Contains the widget id. .SS "legend" .IX Subsection "legend" Arguments: \f(CW$legend\fR .PP Return Value: \f(CW$legend\fR .PP Contains the legend. .SS "method" .IX Subsection "method" Arguments: \f(CW$method\fR .PP Return Value: \f(CW$method\fR .PP Contains the form method. .SS "param" .IX Subsection "param" Arguments: \f(CW$name\fR .PP Return Value (scalar context): \f(CW$value\fR or \e@values .PP Return Value (list context): \f(CW@values\fR .PP Returns valid parameters with a \s-1CGI\s0.pm\-compatible param method. (read-only) .SS "params" .IX Subsection "params" .SS "parameters" .IX Subsection "parameters" Return Value: \e%params .PP Returns validated params as hashref. .PP \&\*(L"parameters\*(R" is an alias for \*(L"params\*(R". .SS "subcontainer" .IX Subsection "subcontainer" Arguments: \f(CW$tag\fR .PP Return Value: \f(CW$tag\fR .PP Contains the subcontainer tag. .SS "strict" .IX Subsection "strict" Arguments: \f(CW$bool\fR .PP Return Value: \f(CW$bool\fR .PP Only consider parameters that pass at least one constraint valid. .SS "submitted" .IX Subsection "submitted" .SS "is_submitted" .IX Subsection "is_submitted" Return Value: \f(CW$bool\fR .PP Returns true if \f(CW\*(C`$widget\->process\*(C'\fR received a \f(CW$query\fR object. .PP \&\*(L"is_submitted\*(R" is an alias for \*(L"submitted\*(R". .SS "valid" .IX Subsection "valid" Return Value: \f(CW@names\fR .PP Arguments: \f(CW$name\fR .PP Return Value: \f(CW$bool\fR .PP Returns a list of element names. Returns true/false if a name is given. .PP .Vb 2 \& my @names = $form\->valid; \& my $valid = $form\->valid($name); .Ve .SS "add_valid" .IX Subsection "add_valid" Arguments: \f(CW$key\fR, \f(CW$value\fR .PP Return Value: \f(CW$value\fR .PP Adds another valid value to the hash. .SS "add_error" .IX Subsection "add_error" Arguments: \e%attributes .PP Return Value: \f(CW$error\fR .PP .Vb 1 \& $result\->add_error({ name => \*(Aqfoo\*(Aq }); .Ve .PP This allows you to add custom error messages after the widget has processed the input params. .PP Accepts 'name', 'type' and 'message' arguments. The 'name' argument is required. The default value for 'type' is 'Custom'. The default value for 'message' is 'Invalid Input'. .PP An example of use. .PP .Vb 3 \& if ( ! $result\->has_errors ) { \& my $user = $result\->valid(\*(Aqusername\*(Aq); \& my $pass = $result\->valid(\*(Aqpassword\*(Aq); \& \& if ( ! $app\->login( $user, $pass ) ) { \& $result\->add_error({ \& name => \*(Aqpassword\*(Aq, \& message => \*(AqIncorrect Password\*(Aq, \& }); \& } \& } .Ve .PP In this example, the \f(CW$result\fR initially contains no errors. If the \fIlogin()\fR is unsuccessful though, \fIadd_error()\fR is used to add an error to the password Element. If the user is shown the form again using \f(CW\*(C`$result\->as_xml\*(C'\fR, they will be shown an appropriate error message alongside the password field. .SH "AUTHOR" .IX Header "AUTHOR" Sebastian Riedel, \f(CW\*(C`sri@oook.de\*(C'\fR .SH "LICENSE" .IX Header "LICENSE" This library is free software, you can redistribute it and/or modify it under the same terms as Perl itself.