Form::Factory::Interface::HTML - Simple HTML form interface


NAME

Form::Factory::Interface::HTML - Simple HTML form interface


VERSION

version 0.014


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 the Form::Factory::Action manpage.


METHODS

new_widget_for_control

Returns a the Form::Factory::Interface::HTML::Widget manpage implementation for the given control.

new_widget_for_button

Returns a widget for a the Form::Factory::Control::Button manpage.

new_widget_for_checkbox

Returns a widget for a the Form::Factory::Control::Checkbox manpage.

new_widget_for_fulltext

Returns a widget for a the Form::Factory::Control::FullText manpage.

new_widget_for_password

Returns a widget for a the Form::Factory::Control::Password manpage.

new_widget_for_selectmany

Returns a widget for a the Form::Factory::Control::SelectMany manpage.

new_widget_for_selectone

Returns a widget for a the Form::Factory::Control::SelectOne manpage.

new_widget_for_text

Returns a widget for a the Form::Factory::Control::Text manpage.

new_widget_for_value

Returns a widget for a the Form::Factory::Control::Value manpage.

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

the Form::Factory::Interface manpage


AUTHOR

Andrew Sterling Hanenkamp <hanenkamp@cpan.org>


COPYRIGHT AND LICENSE

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::Interface::HTML - Simple HTML form interface