[html-formfu] Pre-populating a form (no submit yet)

Rippl, Steve rippls at woodlandschools.org
Thu Sep 22 20:40:32 GMT 2011


On Thu, Sep 22, 2011 at 1:10 PM, J. Bobby Lopez <jbl at jbldata.com> wrote:

>
> Hello,
>
> I'm trying to figure out how to pre-populate a formfu form with data I
> have in a %hash.  The keys in the hash match the names of form
> elements (if that's helpful at all).
>
> The problem I'm running into is understanding how $form->process()
> works if nothing has been submitted.  If there has been no form
> submission (and therefore no $query_object), how can I get formfu to
> populate fields with existing data from my %hash?
>
> Reviewing formfu docs didn't provide any insight on this (or I missed
> it).  Can anyone shed some light on this?
>
> Thanks,
> -Bobby
>
> _______________________________________________
> HTML-FormFu mailing list
> HTML-FormFu at lists.scsys.co.uk
> http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu
>


Untested code, but something like...

while ( my ($name, $value) =3D each %hash_of_data ) {
  $form->get_element({name =3D> $name})->value($value);
}



-- =

Steve Rippl
Technology Director
Woodland Public Schools
360 841 2730
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/html-formfu/attachments/20110922/80=
22d428/attachment.htm


More information about the HTML-FormFu mailing list