| Form-Factory documentation | view source | Contained in the Form-Factory distribution. |
Form::Factory::Interface::HTML - Simple HTML form interface
version 0.020
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;
This renders plain HTML forms and consumes value from a hash.
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 @_ }
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.
Returns a Form::Factory::Interface::HTML::Widget implementation for the given control.
Returns a widget for a Form::Factory::Control::Checkbox.
Returns a widget for a Form::Factory::Control::FullText.
Returns a widget for a Form::Factory::Control::Password.
Returns a widget for a Form::Factory::Control::SelectMany.
Returns a widget for a Form::Factory::Control::SelectOne.
Returns a widget for a Form::Factory::Control::Text.
Returns a widget for a Form::Factory::Control::Value.
Renders the widget for the given control.
Consumes values using the widget for the given control.
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.
Andrew Sterling Hanenkamp <hanenkamp@cpan.org>
Copyright 2009 Qubling Software LLC.
This library is free software. You can redistribute it and/or modify it under the same terms as Perl itself.
| Form-Factory documentation | view source | Contained in the Form-Factory distribution. |