This was observed using HTML::Widget version 1.10:

$form = HTML::Widget->new();
$form->element('Hidden','hidden1');
$form->element('Textfield')->name('textfield1');
$result = $form->process( $params );
print scalar $result->elements; # prints "2" ($result->elements
contains 'hidden1' and 'textfield1')

$form = HTML::Widget->new();
$form->element('Hidden','hidden1');
$fieldset = $form->element( 'Fieldset', 'fieldset1' );
$fieldset->element('Textfield')->name('textfield1');
$result = $form->process( $params );
print scalar $result->elements; # prints "1" ($result->elements
contains only 'hidden1')

It appears that if a HTML::Widget::Element::Fieldset is added to a
widget after any other element (other than another Fieldset), it is
not returned by $result->elements.

Adding all non-Fieldset elements to a Fieldset and adding that to the
main widget, so only Fieldsets are added to the main widget, seems to
be an effective workaround.

Is this expected behaviour? If best practice is to wrap all elements
in Fieldsets, I'd have expected a warning/error of some sort when
trying to do it differently.

Thanks, Will

_______________________________________________
Html-widget mailing list
Html-widget@lists.rawmode.org
http://lists.rawmode.org/cgi-bin/mailman/listinfo/html-widget

Reply via email to