[Html-widget] formfu recent updates

Carl Franks fireartist at gmail.com
Fri Mar 23 12:36:50 GMT 2007


There's now support for displaying a message at the top of the form if
there were any errors.
It's only activated by setting $form->form_error_message().
It uses the 'form_error_message' template. The default is to just
display a div containing the value of form_error_message().
The I18N english package provides a simple message, so you can just set
     $form->form_error_message_loc( 'form_error_message' );
and a friendly message will be displayed.

Filters -> Constraints -> Inflators -> Validators -> Transformers
The change from simple constraints to a more advanced framework has been done.
We're still needing more tests, but the basics are there.

There's a new HTML-FormFu-Imager package availalable here:
http://html-formfu.googlecode.com/svn/trunk/HTML-FormFu-Imager/
It includes an Imager inflator, size-validator, and transformer.

File upload handling has been improved, and standardized so you can
switch between Catalyst, CGI and CGI::Simple without having to change
your code.
Catalyst automated tests are needed though.

There's a new 'simple_table' element, which will allow you to render a
group of elements in a table.
It provides headers() and rows() methods, and also provides support
for setting class-names on either odd or even rows.

See this file for an example config:
http://html-formfu.googlecode.com/svn/trunk/HTML-FormFu/t/element_simple_table.yml
This file for an example of the markup:
http://html-formfu.googlecode.com/svn/trunk/HTML-FormFu/t/element_simple_table.t
And, just for a change, there's even some documentation!
http://html-formfu.googlecode.com/svn/trunk/HTML-FormFu/lib/HTML/FormFu/Element/simple_table.pm

There's a new 'hr' element - it creates a horizontal rule. That's all
that can be said about that.

'block' elements now have a content() method - so, for example, you
could add an introductory paragraph with just:
    type: block
    tag: p
    content: please fill in the form!
There are also the usual content_xml() and content_loc() variants.

If you want to change the tag used to contain a single field, you can now set
    $field->container_tag()
to change it.
At the moment the default is 'span', but I'm starting to come round to
the idea of changing it to 'div', for a better default layout without
css.

The radiogroup's been fixed, so it displays error messages.

The css demo application has been updated, and the provided
'vertically-aligned' example css file has been updated to display
error messages nicer by default.
http://www.fireartist.com/html-formfu-cssapp/

Carl



More information about the Html-widget mailing list