GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Form::Sensible::Validator::Result(3) User Contributed Perl Documentation Form::Sensible::Validator::Result(3)

Form::Sensible::Validator::Result - Validation results for a given form.

    my $result = $form->validate();

    if (!$result->is_valid()) {
         foreach my $key ( keys %{$result->error_fields()} ) {
             foreach my $message ( @{ $result->error_fields->{$key} } ) {
                    print $message;
             }
         }
    }

The "Form::Sensible::Validator::Result|Form::Sensible::Validator::Result" class is used to store the results of form validation. It is very simple to work with and has some additional methods to make it more familiar to anyone who has used FormValidator::Simple. The additional methods are intended to function similar to the FormValidator::Simple Results class

"is_valid()"
Returns true if the form passed validation, false otherwise.
"error_fields"
Returns a hashref containing "fieldname => error_array" pairs. Each field with an error will be present as a key in this hash and the value will be an arrayref containing one or more error messages.
"missing_fields"
Works exactly as error_fields, only contains only entries for fields that were required but were not present.
"add_error($fieldname, $message)"
Adds $message as an error on the field provided. There can be more than one error message for a given field.
"add_missing($fieldname, $message)"
Adds $message as an missing field error on the field provided. Like errors, there can be more than one missing field message for a given field.

The following routines are things that make Form::Sensible::Validator results behave more like "FormValidator::Simple|FormValidator::Simple"'s Result class.

8
"has_missing"
Returns true if there were missing values in the form;
"has_invalid"
Returns true if any fields in the form were invalid.
"has_error"
Returns true if there are any invalid or missing fields with the form validation. Essentially the inverse of is_valid
"success"
Synonym for is_valid. Returns true if all fields passed validation.
"missing($fieldname)"
If $fieldname is provided, returns true if the field provided was missing, false otherwise. If no fieldname is provided, returns an array of fieldnames that were missing in the form.
"invalid($fieldname)"
If $fieldname is provided, returns true if the field provided was invalid, false otherwise. If no fieldname is provided, returns an array of fieldnames that were invalid in the form.
"error($fieldname)"
If $fieldname is provided, returns true if the field provided was either missing or invalid, false otherwise. If no fieldname is provided, returns an array of fieldnames that were either missing or invalid in the form.
"message_for($fieldname)"
Returns all the error messages (including errors and missing notifications) for the fieldname provided. Returns an empty array if there are no errors on the given field.

Jay Kuri - <jayk@cpan.org>

Ionzero LLC. <http://ionzero.com/>

Form::Sensible

Copyright 2009 by Jay Kuri <jayk@cpan.org>

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

Hey! The above document had some coding errors, which are explained below:
Around line 232:
'=item' outside of any '=over'
2012-02-02 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.