Skip Menu |

This queue is for tickets about the HTML-Widget CPAN distribution.

Report information
The Basics
Id: 20313
Status: resolved
Priority: 0/
Queue: HTML-Widget

People
Owner: Nobody in particular
Requestors: jon.schutz [...] youramigo.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 1.07
Fixed in: (no value)



Subject: embed() discards top level controls
HTML-Widget-1.07, Perl 5.8.5, Centos 4 Linux If you have a widget, add some elements, then embed some other forms, the initially added elements fail to be rendered. Example code: ---- #! /usr/bin/perl use strict; use warnings; use HTML::Widget; my $w = HTML::Widget->new->method('post')->action('/foo/bar'); $w->element( 'Textfield', 'age' )->label('Age')->size(3); my $w2 = HTML::Widget->new('foo')->action('/foo'); # Add a standalone element to the containing w2 $w2->element( 'Textfield', 'allbymyself' )->label('All By Myself')->size(3); #print $w2->process . "\n\n"; my $w3 = HTML::Widget->new('bar'); $w3->element( 'Textfield', 'baz' ); $w2->embed($w); $w2->embed($w3); my $f = $w2->process; print $f; --- Example output: <form action="/foo" id="foo" method="post"><fieldset id="foo_widget"><label for="foo_widget_age" id="foo_widget_age_label">Age<input class="textfield" id="foo_widget_age" name="age" size="3" type="text" /></label></fieldset><fieldset id="foo_bar"><input class="textfield" id="foo_bar_baz" name="baz" type="text" /></fieldset></form> Note the absence of the 'allbymyself' element.
From: Ash Berlin
This 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? Merged into first one? Before embedded? After? etc. etc. If you can come up with a decent way of specifiying this, and provide tests for it then we can implement it. Thanks, Ash Berlin On Wed Jul 05 22:06:32 2006, guest wrote: Show quoted text
> HTML-Widget-1.07, Perl 5.8.5, Centos 4 Linux > > If you have a widget, add some elements, then embed some other forms, > the initially added elements fail to be rendered. > > Example code: > > ---- > > #! /usr/bin/perl > > use strict; > use warnings; > use HTML::Widget; > > my $w = HTML::Widget->new->method('post')->action('/foo/bar'); > $w->element( 'Textfield', 'age' )->label('Age')->size(3); > > my $w2 = HTML::Widget->new('foo')->action('/foo'); > > # Add a standalone element to the containing w2 > $w2->element( 'Textfield', 'allbymyself' )->label('All By
Myself')->size(3); Show quoted text
> > #print $w2->process . "\n\n"; > > my $w3 = HTML::Widget->new('bar'); > $w3->element( 'Textfield', 'baz' ); > > $w2->embed($w); > $w2->embed($w3); > > my $f = $w2->process; > > print $f; > > --- > > Example output: > > <form action="/foo" id="foo" method="post"><fieldset > id="foo_widget"><label for="foo_widget_age" > id="foo_widget_age_label">Age<input class="textfield" > id="foo_widget_age" name="age" size="3" type="text" > /></label></fieldset><fieldset id="foo_bar"><input class="textfield" > id="foo_bar_baz" name="baz" type="text" /></fieldset></form> > > Note the absence of the 'allbymyself' element. > >
Subject: Re: [rt.cpan.org #20313] embed() discards top level controls
Date: Fri, 07 Jul 2006 09:50:17 +0930
To: bug-HTML-Widget [...] rt.cpan.org
From: Jon Schutz <Jon.Schutz [...] youramigo.com>
Hello Ash, I would have thought you would use nested fieldsets. The HTML 4 spec allows for this, and although browsers historically had some difficulties rendering them, current browsers seem to support it. Currently if you just have one top level widget, it would end up in a fieldset thus: <fieldset> <input ...> </fieldset> So it seems to me that the logical extension of this is that if you embed 2 other widgets, it should end up like this: <fieldset> <input ...> <fieldset> <input ...> </fieldset> <fieldset> <input ...> </fieldset> </fieldset> This model would hold to any depth, e.g. with an embedded widget inside an embedded widget: <fieldset> <input ...> <fieldset> <input ...> <fieldset> <input ...> </fieldset> </fieldset> </fieldset> Please see attached test.html, which validates. Regards, -- Jon On Thu, 2006-07-06 at 18:57 -0400, Ash Berlin via RT wrote: Show quoted text
> <URL: http://rt.cpan.org/Ticket/Display.html?id=20313 > > > This 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? Merged into first one? Before embedded? After? > etc. etc. > > If you can come up with a decent way of specifiying this, and provide > tests for it then we can implement it. > > Thanks, > Ash Berlin > > On Wed Jul 05 22:06:32 2006, guest wrote:
> > HTML-Widget-1.07, Perl 5.8.5, Centos 4 Linux > > > > If you have a widget, add some elements, then embed some other forms, > > the initially added elements fail to be rendered. > > > > Example code: > > > > ---- > > > > #! /usr/bin/perl > > > > use strict; > > use warnings; > > use HTML::Widget; > > > > my $w = HTML::Widget->new->method('post')->action('/foo/bar'); > > $w->element( 'Textfield', 'age' )->label('Age')->size(3); > > > > my $w2 = HTML::Widget->new('foo')->action('/foo'); > > > > # Add a standalone element to the containing w2 > > $w2->element( 'Textfield', 'allbymyself' )->label('All By
> Myself')->size(3);
> > > > #print $w2->process . "\n\n"; > > > > my $w3 = HTML::Widget->new('bar'); > > $w3->element( 'Textfield', 'baz' ); > > > > $w2->embed($w); > > $w2->embed($w3); > > > > my $f = $w2->process; > > > > print $f; > > > > --- > > > > Example output: > > > > <form action="/foo" id="foo" method="post"><fieldset > > id="foo_widget"><label for="foo_widget_age" > > id="foo_widget_age_label">Age<input class="textfield" > > id="foo_widget_age" name="age" size="3" type="text" > > /></label></fieldset><fieldset id="foo_bar"><input class="textfield" > > id="foo_bar_baz" name="baz" type="text" /></fieldset></form> > > > > Note the absence of the 'allbymyself' element. > > > >
> >

Message body is not shown because sender requested not to inline it.

CC: bug-HTML-Widget [...] rt.cpan.org
Subject: Re: [Html-widget] Fwd: [rt.cpan.org #20313] embed() discards top level controls
Date: Mon, 10 Jul 2006 18:28:22 +0200
To: html-widget [...] lists.rawmode.org
From: "A. Pagaltzis" <pagaltzis [...] gmx.de>
* Ash Berlin <ash@cpan.org> [2006-07-07 00:55]: Show quoted text
> 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.
Inside the fieldset, where else? Fieldsets can be nested. Bung this into the validator for a demonstration: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>x</title> </head> <body> <form action="x"> <fieldset> <input name="x"/> <fieldset> <input name="y"/> </fieldset> </fieldset> </form> </body> </html> Regards, -- Aristotle Pagaltzis // <http://plasmasturm.org/>
embed() has recently been completely rewritten, and your code example would now give this output. <form action="/foo" id="foo" method="post"> <fieldset> <label for="foo_allbymyself" id="foo_allbymyself_label">All By Myself <input class="textfield" id="foo_allbymyself" name="allbymyself" size="3" type="text" /> </label> </fieldset> <fieldset> <label for="foo_age" id="foo_age_label">Age <input class="textfield" id="foo_age" name="age" size="3" type="text" /> </label> </fieldset> <fieldset> <input class="textfield" id="foo_baz" name="baz" type="text" /> </fieldset> </form> It is now recommended you create fieldsets, and use them directly, rather than using embed. Example: my $w = HTML::Widget->new; my $outer_fs = $w->element( 'Fieldset', 'outer' ); $outer_fs->element( 'Textfield', 'allbymyself' ); $outer_fs->element( 'Fieldset', 'first' ) ->element( 'Textfield', 'age' ); $outer_fs->element( 'Fieldset', 'second' ) ->element( 'Textfield', 'baz' ); print $w->process; Would give this output with nested fieldsets: <form id="widget" method="post"> <fieldset id="widget_outer"> <input class="textfield" id="widget_outer_allbymyself" name="allbymyself" type="text" /> <fieldset id="widget_outer_first"> <input class="textfield" id="widget_outer_first_age" name="age" type="text" /> </fieldset> <fieldset id="widget_outer_second"> <input class="textfield" id="widget_outer_second_baz" name="baz" type="text" /> </fieldset> </fieldset> </form> Cheers, Carl