in reply to Re: HTML::FormHandler rendering
in thread HTML::FormHandler rendering (somewhat SOLVED)

Thank you. That is a nice trick.

But I did go through the source code myself already and it indeed seems there is some way of adding a <legend> tag, but the question is how?

What I have now is:

package MyApp::Form::Book; use HTML::FormHandler::Moose; extends 'HTML::FormHandler::Model::DBIC'; use namespace::autoclean; has '+item_class' => ( default =>'Books' ); has '+name' => ( default => 'book_form' ); has_field 'title' => ( minlength => 5, maxlength => 40, required => 1, + css_class => 'my-css-class' ); has_field 'rating' => ( type => 'Integer', range_start => 1, range_end + => 5 ); has_field 'authors' => ( type => 'Multiple', label_column => 'last_nam +e', required => 1 ); has_field 'submit' => ( type => 'Submit', value => 'Submit' ); __PACKAGE__->meta->make_immutable; 1;
And I have no clue how to add the legend tag.

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

Replies are listed 'Best First'.
Re^3: HTML::FormHandler rendering
by Anonymous Monk on May 15, 2010 at 23:53 UTC
    If you look at the files returned by rep, like t/render.t, you can see its through naming convention.

    Does that makes sense?

    From your example I can't tell what you want to become legend/fieldset. If you could explain that, then it might become clear if HTML::FormHandler needs patching, or if you need to create your own renderer or something else :)

    FWIW, fieldset/legend doesn't look all that useful to me

      It seems that HTML::FormHandler::Render::Simple cannot do what I was trying to achieve.

      It uses a <fieldset> with a <legend> tag only for compound fields (such as a DateTime with Day, Month and Year sub-fields). This is of course perfectly OK and is exactly what <fieldset> is all about: visually grouping together related fields in a form.

      True to its nature HTML::FormHandler::Render::Simple takes this one step further and automatically assembles the parent-field out of the sub-fields.

      However I only wanted to do the visually grouping together without the auto-assembly of a compound field. I guess I will have to write my own renderer for that.

      CountZero

      A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James