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


FormValidator documentation  | view source Contained in the FormValidator distribution.

Index


NAME

Top

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

SYNOPSIS

Top

    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

Top

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

valid( [field] )

Top

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()

Top

This method returns true if the results contains missing fields.

missing( [field] )

Top

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()

Top

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

invalid( [field] )

Top

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()

Top

This method returns true if the results contains unknown fields.

unknown( [field] )

Top

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()

Top

This method returns true if the results contains conflicts.

warnings( [field] )

Top

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()

Top

Return true if some fields have conflicts.

conflicts( [field] )

Top

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

Top

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

AUTHOR

Top

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

COPYRIGHT

Top


FormValidator documentation  | view source Contained in the FormValidator distribution.