Francis J. Lacoste > FormValidator > HTML::FormValidator::Results

Download:
FormValidator-0.11.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  1
Open  0
View/Report Bugs
Source  

NAME ^

HTML::FormValidator::Results - Object which contains the results of an input validation.

SYNOPSIS ^

    my $results = $validator->check( \%fdat, "customer_infos" );

    # Print the name of missing fields
    if ( $results->has_missing ) {
        foreach my $f ( $results->missing ) {
            print $f, " is missing\n";
        }
    }

    # Print the name of invalid fields
    if ( $results->has_invalid ) {
        foreach my $f ( $results->invalid ) {
            print $f, " is invalid: ", $results->invalid( $f ) \n";
        }
    }

    # Print fields with warnings
    if ( $results->has_warnings ) {
        foreach my $f ( $results->warnings ) {
            print $f, "'s value is not recommended\n";
        }
    }

    # Print unknown fields
    if ( $results->has_unknown ) {
        foreach my $f ( $results->unknown ) {
            print $f, " is unknown\n";
        }
    }

    # Print conflicting fields
    if ( $results->has_conflicts ) {
        foreach my $f ( $results->conflicts ) {
            print $f, " conflicts with ", join( "," $results->conflicts( $f)),  "\n";
        }
    }

    # Print valid fields
    foreach my $f ( $results->valid() ) {
        print $f, " =  ", $result->valid( $f ), "\n";
    }

DESCRIPTION ^

This is the object returned by the HTML::FormValidator check method. It can be queried for information about the validation results.

valid( [field] ) ^

This method returns in an array context the list of fields which contains valid value. In a scalar context, it returns an hash reference which contains the valid fields and their value.

If called with an argument, it returns the value of that field if it contains valid data, undef otherwise.

has_missing() ^

This method returns true if the results contains missing fields.

missing( [field] ) ^

This method returns in an array context the list of fields which are missing. In a scalar context, it returns an array reference to the list of missing fields.

If called with an argument, it returns true if that field is missing, undef otherwise.

has_invalid() ^

This method returns true if the results contains fields with invalid data.

invalid( [field] ) ^

This method returns in an array context the list of fields which contains invalid value. In a scalar context, it returns an hash reference which contains the invalid fields and their value.

If called with an argument, it returns the value of that field if it contains invalid data, undef otherwise.

has_unknown() ^

This method returns true if the results contains unknown fields.

unknown( [field] ) ^

This method returns in an array context the list of fields which are unknown. In a scalar context, it returns an hash reference which contains the unknown fields and their value.

If called with an argument, it returns the value of that field if it is unknown, undef otherwise.

has_warnings() ^

This method returns true if the results contains conflicts.

warnings( [field] ) ^

This method returns in an array context the list of fields which have warnings (a constraint returned -1). In a scalar context, it returns an array reference to the list of fields which have warnings.

If called with an argument, it returns true if that field has a warning associated with it.

has_conflicts() ^

Return true if some fields have conflicts.

conflicts( [field] ) ^

This method returns in an array context the list of fields which contains have conflicts. In a scalar context, it returns an hash reference which contains the fields and their conflicts.

If called with an argument, it returns in an array context the list of conflicts for that field, or an array reference to the conflicts list in a scalar context.

SEE ALSO ^

HTML::FormValidator(3) HTML::FormValidator::Filters(3) HTML::FormValidator::Constraints(3) HTML::FormValidator::ConstraintsFactory(3)

AUTHOR ^

Francis J. Lacoste <francis.lacoste@iNsu.COM>

COPYRIGHT ^

Copyright (c) 1999,2000 iNsu Innovations Inc. All rights reserved.

This program is free software; you can redistribute it and/or modify it under the terms as perl itself.

syntax highlighting: