[Html-widget] Setting field values using query parameters

Zbigniew Lukasiak zzbbyy at gmail.com
Sat Oct 14 17:18:37 CEST 2006


You can process without query -
$widget->process()
And then set the values on the result object.

You might also look at mine, not yet released to CPAN,
HTML::Widget::DBIC - it's avalable at:
http://zby.aster.net.pl/HTML-Widget-DBIC-0.01.tar.gz or it is also a
part of the, released, Catalyst::Example::InstantCRUD.

It does a bit more than the DBIx::Class::HTMLWidget mentioned in
another letter as it can also set values from related tables even for
many-to-many relationship.  It also uses a config to separate the
visual things from the database layer.

--
Zbyszek

On 10/13/06, Will Hawes <info at whawes.co.uk> wrote:
> When a user initially visits a form (i.e. prior to submission), I'd like
> to be able to set field values using query parameters. For example my
> user might click a link such as
> "http://www.domain.com/view_form?field1=value", with field "field1"
> displaying "value" as a result.
>
> As far as I can see the only way to do this at present is to call
> $widget->process( $request ), but that validates all the elements. I
> don't want any validation until the form has been submitted. At this
> point all I want to do is set some field values. I think what I'm after
> is something along the lines of
>
> sub fill {
>    my( $self, $values ) = @_;
>    for my $e ( $self->find_elements ) {
>      my $name = $e->name;
>      my $value = $values->{$name};
>      $e->value($value)
>        if( defined $value && $e->can('value') );
>    }
> }
>
> No provision in the hacked up example for checkboxes etc but hopefully
> you get the idea.
>
> I'd be slightly surprised if something like this doesn't already exist -
> have I missed it?
>
> _______________________________________________
> 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