[Html-widget] Setting field values using query parameters

Zbigniew Lukasiak zzbbyy at gmail.com
Tue Oct 17 10:20:11 CEST 2006


Hi,

I am sure process() does preserve the values, I am using that.

By the way I've just released to CPAN HTML::Widget::DBIC.

--
Zbyszek

On 10/16/06, Will Hawes <info at whawes.co.uk> wrote:
> 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.
>
>
> _______________________________________________
> Html-widget mailing list
> Html-widget at lists.rawmode.org
> http://lists.rawmode.org/cgi-bin/mailman/listinfo/html-widget
>


-- 
Zbigniew Lukasiak
http://brudnopis.blogspot.com/



More information about the Html-widget mailing list