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

Jason Kohles email at jasonkohles.com
Fri Jul 7 01:38:47 CEST 2006


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.

-- 
Jason Kohles
email at jasonkohles.com - http://www.jasonkohles.com/
"A witty saying proves nothing."  -- Voltaire



More information about the Html-widget mailing list