[Html-widget] HTML::Widget and Images inside the <form>
    Brian Kirkbride 
    brian.kirkbride at deeperbydesign.com
       
    Fri Jul 21 02:39:04 CEST 2006
    
    
  
A. Pagaltzis wrote:
> 
> But creating specific HTML form elements is not? :)
> 
>> I think it would be nice for HTML::Widget to allow Elements
>> from outside of the HTML::Widget:: namespace, using
>> +My::App::Radio or the like. I'll probably work up a patch for
>> that at some point.
> 
> And that would not involve creating the specific HTML elements in
> your controller? :)
> 
Point taken :)
Creating your own Element classes still requires that you create the specific 
HTML elements in your code, but *not* in your controller.
It's much cleaner to have your controller do:
   $w->element('+MyApp::ThumbElement', 'thumbnail')->src($url)
rather than:
   $w->element('Span', 'thumbnail')->content(
     HTML::Element->new('span', class => 'thumbnail_outer')
       ->push_content(
         HTML::Element->new('span', class => 'thumbnail_txt')
           ->push_content('Thumbnail image'),
         HTML::Element->new('span', class => 'thumbnail_img')
           ->push_content(
             HTML::Element->new('img', src => $url)
           )
       )
   );
This is a contrived example straight out of my imagination, but not completely 
dissimilar from things I've needed in the past.
Best,
Brian
    
    
More information about the Html-widget
mailing list