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

If you look at the files returned by rep, like t/render.t, you can see its through naming convention.
has_field 'start_date' => ( type => 'DateTime' ); has_field 'start_date.month' => ( type => 'Integer', range_start => + 1, range_end => 12 ); has_field 'start_date.day' => ( type => 'Integer', range_start => 1 +, range_end => 31 ); has_field 'start_date.year' => ( type => 'Integer', range_start => +2000, range_end => 2020 );
generates
<div><fieldset class="start_date"><legend>Start date</legend> <div><label class="label" for="start_date.month">Month: </label><input + type="text" name="start_date.month" id="start_date.month" size="8" v +alue="7" /></div> <div><label class="label" for="start_date.day">Day: </label><input typ +e="text" name="start_date.day" id="start_date.day" size="8" value="14 +" /></div> <div><label class="label" for="start_date.year">Year: </label><input t +ype="text" name="start_date.year" id="start_date.year" size="8" value +="2006" /></div> </fieldset></div>
See also t/compound_field.t is example of HTML::FormHandler::Field::Compound

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

Replies are listed 'Best First'.
Re^4: HTML::FormHandler rendering
by CountZero (Bishop) on May 16, 2010 at 07:54 UTC
    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