<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">NAME
    Validation::Class::Plugin::JavascriptObjects - Javascript Object
    Rendering for Validation::Class

VERSION
    version 7.900021

SYNOPSIS
        # this plugin is in working condition but untested!!!

        use Validation::Class::Simple;
        use Validation::Class::Plugin::JavascriptObjects;

        # given

        my $rules = Validation::Class::Simple-&gt;new(
            fields =&gt; {
                username =&gt; { required =&gt; 1 },
                password =&gt; { required =&gt; 1 },
            }
        );

        # when

        my $objects = $rules-&gt;plugin('javascript_objects');

        print $objects-&gt;render(namespace =&gt; 'form.signup', include =&gt; [qw/errors/]);

        # then, output should be ...

        var form.signup = {
            "password": {
                "errors": ["password is required"]
            },
            "username": {
                "errors": ["username is required"]
            }
        };

DESCRIPTION
    Validation::Class::Plugin::JavascriptObjects is a plugin for
    Validation::Class which can leverage your validation class field
    definitions to render JavaScript objects for the purpose of
    introspection.

METHODS
  render
    The render method converts the attached validation class into a
    javascript object for introspection purposes. This method accepts a list
    of key/value pairs as options.

        $self-&gt;render;

        # or

        $self-&gt;render(
            namespace =&gt; 'Foo.Bar',
            exclude   =&gt; [qw/pattern/]
        );

        # or

        $self-&gt;render(
            namespace =&gt; 'Foo.Baz',
            include   =&gt; [qw/minlength maxlength required/]
        );

        # or, to also limit the fields output

        $self-&gt;render(
            namespace =&gt; 'Foo.Baz',
            fields    =&gt; [qw/this that/],
            include   =&gt; [qw/minlength maxlength required/]
        );

AUTHOR
    Al Newkirk &lt;anewkirk@ana.io&gt;

COPYRIGHT AND LICENSE
    This software is copyright (c) 2011 by Al Newkirk.

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

</pre></body></html>