NAME
Form::Factory::Interface::HTML - Simple HTML form interface
VERSION
version 0.022
SYNOPSIS
use Form::Factory;
my $q = CGI->new;
my $html = '<form>';
my $form = Form::Factory->new(HTML => {
renderer => sub { $html .= join('', @_) },
consumer => sub { shift->Vars },
});
my $action = $form->new_action('MyApp::Action::Foo');
$action->consume_and_clean_and_check_and_process( request => $q );
$action->render;
$html .= '</form>';
print $q->header('text/html');
print $html;
DESCRIPTION
This renders plain HTML forms and consumes value from a hash.
ATTRIBUTES
renderer
This is a code reference responsible for printing the HTML elements. The HTML for the controls is passed to this subroutine as a string. The default implementation just prints to the screen.
sub { print @_ }
consumer
This is a code reference responsible for taking the request object and turning it into a hash reference of values passed in from the HTTP request. The value passed in is the value passed as the request
parameter to "consume" in Form::Factory::Action.
METHODS
new_widget_for_control
Returns a Form::Factory::Interface::HTML::Widget implementation for the given control.
new_widget_for_button
Returns a widget for a Form::Factory::Control::Button.
new_widget_for_checkbox
Returns a widget for a Form::Factory::Control::Checkbox.
new_widget_for_fulltext
Returns a widget for a Form::Factory::Control::FullText.
new_widget_for_password
Returns a widget for a Form::Factory::Control::Password.
new_widget_for_selectmany
Returns a widget for a Form::Factory::Control::SelectMany.
new_widget_for_selectone
Returns a widget for a Form::Factory::Control::SelectOne.
new_widget_for_text
Returns a widget for a Form::Factory::Control::Text.
new_widget_for_value
Returns a widget for a Form::Factory::Control::Value.
render_control
Renders the widget for the given control.
consume_control
Consumes values using the widget for the given control.
CAVEATS
When I initially implemented this, using the widget classes made sense. However, the API has changed in some subtle ways since then. Originally, widgets were a required piece of the factory API, but they are not anymore. As such, they don't make nearly as much sense as they once did.
They will probably be removed in a future release.
SEE ALSO
AUTHOR
Andrew Sterling Hanenkamp <hanenkamp@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2015 by Qubling Software LLC.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.