my $form = Rose::HTML::Form->new;
$form->add_fields( $field );
print $form->html;
I get the following error:
Can't locate object method "items" via package
"Rose::HTML::Form::Field::DateTime::Split::MDYHMS" - no such method,
and none auto-created because it is not a valid HTML attribute for
this class at lib/Rose/HTML/Object.pm line 1008
Rose::HTML::Object::AUTOLOAD('Rose::HTML::Form::Field::DateTime::Split::MDYHMS=HASH(0x224d4b4)')
called at lib/Rose/HTML/Form/Field/Collection.pm line 484
Rose::HTML::Form::Field::Collection::fields_as_children('Rose::HTML::Form=HASH(0x22d9d1c)')
called at lib/Rose/HTML/Object/WithWrapAroundChildren.pm line 34
Rose::HTML::Object::WithWrapAroundChildren::children('Rose::HTML::Form=HASH(0x22d9d1c)')
called at lib/Rose/HTML/Object.pm line 292
Rose::HTML::Object::has_children('Rose::HTML::Form=HASH(0x22d9d1c)')
called at lib/Rose/HTML/Form/Field/Collection.pm line 136
Rose::HTML::Form::Field::Collection::html('Rose::HTML::Form=HASH(0x22d9d1c)')
called at script\synopsis.pl line 36
I see the same thing with
Rose::HTML::Form::Field::DateTime::Split::MonthDayYear.
I'm not sure if this is a bug or just me misunderstanding something,
but the following patch fixes it for me:
--- C:\Perl\site\lib\Rose\HTML\Form\Field\Collection.pm Fri Jul 24 16:25:52 2009
+++ lib\Rose\HTML\Form\Field\Collection.pm Thu Aug 13 13:31:50 2009
@@ -481,7 +481,7 @@
foreach my $field ($self->fields)
{
- if($field->is_flat_group)
+ if($field->is_flat_group && $field->can('items'))
{
push(@children, $field->items);
}
I've fixed this in SVN 1983.
Also keep in mind that $form->html() almost certainly does not do what
you want it to do. There is no single HTML representation of a form.
RHTMLO expects you to lay out your form fields as desired (usually
using some sort of templating language that calls back into your
objects to get the HTML for each field, label, etc.)
The closest thing to "a generic HTML representation of a form" is the
(still undocumented, sorry) $form->html_table method.
-John