# NAME

Validation::Class::Plugin::FormFields - HTML Form Field Renderer for Validation::Class

# VERSION

version 0.33

# SYNOPSIS

    # THIS PLUGIN IS UNTESTED AND MAY BE SUBJECT TO DESIGN CHANGES!!!

    use Validation::Class::Simple;

    my $rules = Validation::Class::Simple->new(
        fields => {
            username    => { required => 1 },
            password    => { required => 1 },
            remember_me => { required => 1, options => ['1|Remember Me?'] }
        }
    );

    my $fields = $rules->plugin('form_fields');

    print $fields->textbox('username');
    print $fields->textbox('password', type => 'password');
    print $fields->checkgroup('remember_me');

# DESCRIPTION

Validation::Class::Plugin::FormFields is a plugin for [Validation::Class](http://search.cpan.org/perldoc?Validation::Class)
which can leverage your validation class field definitions to render HTML form
elements. Please note that this plugin is intentionally lacking in
sophistication and try to take as few liberties as possible.

# RATIONALE

Validation::Class::Plugin::FormFields is not an HTML form handler, nor is it an
HTML form builder, renderer, construction kit, or framework. Why render fields
individually and not the entire form? Form handling is a heavily opinionated
subject and this plugin reflects the following perspective.

HTML form generation, done literally, has too many contraints and considerations
to ever be truly ideal. Consider the following, it's been tried many many times
before, it's never pretty, too many conflicting contexts (css, js, security and
identification), css wants the form configured a certain way for styling
purposes, js wants the form configured a certain way for introspection purposes,
the app wants the form configured a certain way for processing purposes, etc.

So why do we continue to try? HTML forms are like werewolves and developers love
silver bullets, but bullets are actually made out of lead, not silver. So how do
you kill werewolves with lead? Hint, not by shooting them obviously.

I'd argue that we never really wanted complete form rendering anyway, what we
actually wanted was a simple way to reduce the tedium and repetitiveness that
comes with creating HTML form elements and handling submission and validation
of the associated data. We keep getting it wrong because we keep trying to build
on top of the same misconceptions.

So maybe we should backup a bit and try something different. The generating of
HTML elements is alot less constrained and definately much more straight-forward.

# AUTHOR

Al Newkirk <anewkirk@ana.io>

# 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.
