[Html-widget] Fwd: [rt.cpan.org #20313] embed() discards top level controls

Ash Berlin ash at cpan.org
Fri Jul 7 02:30:06 CEST 2006


Jason Kohles wrote:
> On 7/6/06, Ash Berlin <ash at cpan.org> wrote:
>   
>> I'll reply to this - it is by design, since the HTML standard says the
>> only thing a form can contain is block level elements (div or fieldset
>> mainly) so where would you put them? In another field set? Before
>> embedded? After? etc. etc.
>>
>>     
> Which standard?  XHTML 1.0 says:
>
> <!ENTITY % inline.forms "input | select | textarea | label | button">
> <!ENTITY % inline "a | %special; | %fontstyle; | %phrase; | %inline.forms;">
> <!ENTITY % form.content "(#PCDATA | %block; | %inline; | %misc;)*">
> <!ELEMENT form %form.content;>
>
> Which indicates that form can indeed contain fieldsets (in fact, if
> forms can only contain block level elements, then that would imply you
> MUST have fieldsets, as input, select, textarea, label, and button are
> not included in the standards list of block-level elements.
>
> Personally what I expected was that embedded forms would be treated as
> "subwidgets", that for example this code:
>
> my $w1 = HTML::Widget->new('outer');
> $w1->element( 'Textfield', 'one' )->label('One');
> $w1->element( 'Textfield', 'two' )->label('Two');
>
> my $w2 = HTML::Widget->new('inner');
> $w2->element( 'Textfield', 'alpha');
> $w2->element( 'Textfield', 'beta' );
>
> $w1->embed($w2);
>
> would produce a form somewhat like this (trimmed for brevity)...
>
> <form>
> <input type="text" name="one">
> <input type="text" name="two">
> <fieldset>
>   <input type="text" name="alpha">
>   <input type="text" name="beta">
> </fieldset>
> </form>
>
> Which, from my interpretation of the standard, is entirely acceptable.
>
>   
http://validator.w3.org/check?uri=http%3A%2F%2Ffiremirror.com%2Fform_test.html&charset=%28detect+automatically%29&doctype=Inline&ss=1&outline=1&sp=1&verbose=1

XHTML 1.0 Strict




More information about the Html-widget mailing list