FAQ

On Mon, 2006-10-16 at 17:54 +0100, Ash Berlin wrote:
Will Hawes wrote:
So next question, along similar lines. Having looked at
DBIx::Class::HTMLWidget, I'm a bit confused by its fill_widget() method.
This sets values using $widget->element()->value() and goes as far as to
show some example Catalyst controller code in the synopsis.

But none of the example TT code I've seen works on the HTML::Widget
object, it all uses the HTML::Widget::Result object generated by
$widget->process(). Whether or not you supply it a query, process()
doesn't appear to preserve any element values. Calling process() after
fill_widget() therefore appears to lose all the values stored by
fill_widget().

It would be possible to create a TT template that iterates through the
elements in a HTML::Widget object, but IMO it would make a lot more
sense if calling process() without a query preserved all the values
stored on individual elements. That way you'd only need a single template.

_______________________________________________
Html-widget mailing list
Html-widget at lists.rawmode.org
http://lists.rawmode.org/cgi-bin/mailman/listinfo/html-widget
fill_widget is designed for the initial load of an edit page. i.e.
setups up current values from a database.
Right, so you currently require one template for initial page edit,
using the HTML::Widget object itself, and another for edit after
submission (e.g. if validation has failed), using a
HTML::Widget::Results object. Or I suppose a single template that
handles both scenarios based on whatever you put in the stash. Either
way, that seems a bit inconsistent.

It would be easier if either $widget->process() allowed you to generate
a Results object while preserving field values, or failing that $widget
provided its own as_XML() method. Then your edit template could just be

[% widget_or_result.as_XML %]

in either case.

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 7 of 10 | next ›
Discussion Overview
grouphtml-widget @
categoriesperl, catalyst
postedOct 13, '06 at 4:17p
activeOct 17, '06 at 2:40p
posts10
users5
websitemetacpan.org...

People

Translate

site design / logo © 2021 Grokbase