On Wednesday 19 September 2007 17:34:25 Andreas Borowski wrote:
> Hi,
>
> is there a method to provide default values for each element in a form
> from a hash? Something like:
>  $form->set_default_values(
>        { street => 'Bakerstreet',
>          city => 'London'}
>  );
>
> So far, I tried $form->process( %hash ). This fills in the values into
> the fields, but also creates unwanted error-messages for failed
> constraints.

You can use something like te following before calling 'process':
$hashref = { street => 'Bakerstreet', city => 'London'};
map { $form->get_field( $_ )->default( $hashref->{$_} ) } keys $hashref;

Greets,
Mario

_______________________________________________
HTML-FormFu mailing list
HTML-FormFu@lists.scsys.co.uk
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu

Reply via email to