{
    "mode": "perldoc",
    "parameter": "Data::FormValidator::Results",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/Data%3A%3AFormValidator%3A%3AResults/json",
    "generated": "2026-06-09T12:18:06Z",
    "synopsis": "my $results = Data::FormValidator->check(\\%inputhash, \\%dfvprofile);\n# Print the name of missing fields\nif ( $results->hasmissing ) {\nfor my $f ( $results->missing ) {\nprint $f, \" is missing\\n\";\n}\n}\n# Print the name of invalid fields\nif ( $results->hasinvalid ) {\nfor my $f ( $results->invalid ) {\nprint $f, \" is invalid: \", $results->invalid( $f ), \"\\n\";\n}\n}\n# Print unknown fields\nif ( $results->hasunknown ) {\nfor my $f ( $results->unknown ) {\nprint $f, \" is unknown\\n\";\n}\n}\n# Print valid fields\nfor my $f ( $results->valid() ) {\nprint $f, \" =  \", $results->valid( $f ), \"\\n\";\n}",
    "sections": {
        "NAME": {
            "content": "Data::FormValidator::Results - results of form input validation.\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "my $results = Data::FormValidator->check(\\%inputhash, \\%dfvprofile);\n\n# Print the name of missing fields\nif ( $results->hasmissing ) {\nfor my $f ( $results->missing ) {\nprint $f, \" is missing\\n\";\n}\n}\n\n# Print the name of invalid fields\nif ( $results->hasinvalid ) {\nfor my $f ( $results->invalid ) {\nprint $f, \" is invalid: \", $results->invalid( $f ), \"\\n\";\n}\n}\n\n# Print unknown fields\nif ( $results->hasunknown ) {\nfor my $f ( $results->unknown ) {\nprint $f, \" is unknown\\n\";\n}\n}\n\n# Print valid fields\nfor my $f ( $results->valid() ) {\nprint $f, \" =  \", $results->valid( $f ), \"\\n\";\n}\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "This object is returned by the Data::FormValidator \"check\" method. It can be queried for\ninformation about the validation results.\n\nsuccess();\nThis method returns true if there were no invalid or missing fields, else it returns false.\n\nAs a shorthand, When the $results object is used in boolean context, it is overloaded to use the\nvalue of success() instead. That allows creation of a syntax like this one used in\n\"CGI::Application::Plugin::ValidateRM\":\n\nmy $results = $self->checkrm('formdisplay','formprofile') || return $self->dfverrorpage;\n\nvalid( [[field] [, value]] );\nIn list context with no arguments, it returns the list of fields which contain valid values:\n\n@allvalidfieldnames = $r->valid;\n\nIn a scalar context with no arguments, it returns an hash reference which contains the valid\nfields as keys and their input as values:\n\n$allvalidhref = $r->valid;\n\nIf called with one argument in scalar context, it returns the value of that \"field\" if it\ncontains valid data, \"undef\" otherwise. The value will be an array ref if the field had multiple\nvalues:\n\n$value = $r->valid('field');\n\nIf called with one argument in list context, it returns the values of \"field\" as an array:\n\n@values = $r->valid('field');\n\nIf called with two arguments, it sets \"field\" to \"value\" and returns \"value\". This form is\nuseful to alter the results from within some constraints. See the\nData::FormValidator::Constraints documentation.\n\n$newvalue = $r->valid('field',$newvalue);\n\nhasmissing()\nThis method returns true if the results contain missing fields.\n\nmissing( [field] )\nIn list context it returns the list of fields which are missing. In a scalar context, it returns\nan array reference to the list of missing fields.\n\nIf called with an argument, it returns true if that \"field\" is missing, undef otherwise.\n\nhasinvalid()\nThis method returns true if the results contain fields with invalid data.\n\ninvalid( [field] )\nIn list context, it returns the list of fields which contains invalid value.\n\nIn a scalar context, it returns an hash reference which contains the invalid fields as keys, and\nreferences to arrays of failed constraints as values.\n\nIf called with an argument, it returns the reference to an array of failed constraints for\n\"field\".\n\nhasunknown()\nThis method returns true if the results contain unknown fields.\n\nunknown( [field] )\nIn list context, it returns the list of fields which are unknown. In a scalar context, it\nreturns an hash reference which contains the unknown fields and their values.\n\nIf called with an argument, it returns the value of that \"field\" if it is unknown, undef\notherwise.\n\nmsgs([config parameters])\nThis method returns a hash reference to error messages. The exact format is determined by\nparameters in the \"msgs\" area of the validation profile, described in the Data::FormValidator\ndocumentation.\n\nNOTE: the \"msgs\" parameter in the profile can take a code reference as a value, allowing\ncomplete control of how messages are generated. If such a code reference was provided there, it\nwill be called here instead of the usual processing, described below. It will receive as\narguments the Data::FormValidator::Results object and a hash reference of control parameters.\n\nThe hashref passed in should contain the same options that you can define in the validation\nprofile. This allows you to separate the controls for message display from the rest of the\nprofile. While validation profiles may be different for every form, you may wish to format\nmessages the same way across many projects.\n\nControls passed into the <msgs> method will be applied first, followed by ones applied in the\nprofile. This allows you to keep the controls you pass to \"msgs\" as \"global\" and override them\nin a specific profile if needed.\n\nmeta()\nIn a few cases, a constraint may discover meta data that is useful to access later. For example,\nwhen using Data::FormValidator::Constraints::Upload, several bits of meta data are discovered\nabout files in the process of validating. These can include \"bytes\", \"width\", \"height\" and\n\"extension\". The \"meta()\" function is used by constraint methods to set this data. It's also\nused to access this data. Here are some examples.\n\n# return all field names that have meta data\nmy @fields = $results->meta();\n\n# To retrieve all meta data for a field:\n$metahref = $results->meta('img');\n\n# Access a particular piece:\n$width = $results->meta('img')->{width};\n\nHere's how to set some meta data. This is useful to know if you are writing your own complex\nconstraint.\n\n$self->meta('img', {\nwidth  => '50',\nheight => '60',\n});\n\nThis function does not currently support multi-valued fields. If it does in the future, the\nabove syntax will still work.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "Data::FormValidator, Data::FormValidator::Filters, Data::FormValidator::Constraints,\nData::FormValidator::ConstraintsFactory\n",
            "subsections": []
        },
        "AUTHOR": {
            "content": "Author: Francis J. Lacoste <francis.lacoste@iNsu.COM> Maintainer: Mark Stosberg\n<mark@summersault.com>\n",
            "subsections": []
        },
        "COPYRIGHT": {
            "content": "Copyright (c) 1999,2000 iNsu Innovations Inc. All rights reserved.\n\nThis program is free software; you can redistribute it and/or modify it under the terms as perl\nitself.\n",
            "subsections": []
        }
    },
    "summary": "Data::FormValidator::Results - results of form input validation.",
    "flags": [],
    "examples": [],
    "see_also": []
}