[Html-widget] strange error with HTMLEscape filter when installing latest from CPAN

Carl Franks fireartist at gmail.com
Sat Dec 2 16:56:04 GMT 2006


On 01/12/06, Bernhard Graf <html-widget at augensalat.de> wrote:
> Carl Franks wrote:
>
> > > I find this feature *very* usefull!
> > >
> > > Otherwise you have no chance to indent <options> in a <select>
> > > list:
> > >
> > > color
> > >   red
> > >   green
> > >   blue
> > > taste
> > >   sweet
> > >   bitter
> > >
> > > (done with leading &nbsp;)
> >
> > That would be better done with an optgroup form field.
>
> No, for two reasons:
> - Support for <optgroup> in all browsers is half-baken
> - <optgroup> is only defined two-levels deep (main and sub)
>
> Btw. - how do I do optgroups with HTML::Widget?
>
> > Or you could use the mentioned ~literal element, which ensures your
> > &nbsp; isn't encoded (if using HTML::Element for select options
> > doesn't yet work, patches welcome!)
>
> Hmm, tell us more about the ~literal element...

  my $form = HTML::Widget->new;

  my $literal = HTML::Element->new( '~literal' text => '&nbsp;Foo' );

  $form->element( Select => me' )
       ->options( foo => $literal );

  print $form->result;

As you can see, it's not double encoded...

<form action="/" id="widget" method="post">
  <fieldset>
    <select class="select" id="widget_me" name="me">
      <option value="foo">&nbsp;Foo</option>
    </select>
  </fieldset>
</form>

Though, the HTML::Widget on this box is v1.05, so hopefully it's not
been broken since then :)

Carl



More information about the Html-widget mailing list