But for once the unanticipated behaviour is actually very useful! I was working on this method from my CGI::Application based webapp when I got interupted. Without thinking I ran the ocde and it did what I need. But I new I hadn't used the $form->output method to get the final HTML fragment for the form, which I was then going to pass through HTML::FillInForm. It turns out that passing \$form to HTML::FillInForm got me the results I wanted anyway - BEFORE I had parsed the template.
Here is the code fragment, it works and for that I am grateful, but I am not sure why! Can somebody help me understand please?
jdtorontosub en_display { # Display 'full signup or enroll' form my $self = shift; my $errs = shift; my $form_output =''; my $sess = $self->param('up_session'); my %data = ''; my $page = $self->load_tmpl('gila/index.html'); my $form = $self->load_tmpl('ap_enroll.html', die_on_bad_params => + 0); # If _IS_USER is present and _IS_REGISTERED is set then we have pa +rtial data in the DB. if ( $sess->param('_IS_USER') && $sess->param('_IS_REGISTERED') && + !ref $errs ) { my $obj = AppSys::User->search( 'upusername' => $sess->param(' +_IS_USER')); while ( my $usr = $obj->next ) { foreach ( $usr->columns ) { $data{$_} = $usr->$_; } } # Get partial data into form, add to page and output my $fif = HTML::FillInForm->new(); $fif->fill(scalarref => \$form, fdat => \%data); $page->param('form_text' => $form->output()); return $page->output(); } elsif ( ref $errs ) { # If there are errors then D::FV has handled HTML stuff $form->param($errs); $page->param('form_text' => $form->output()); return $page->output(); } else { # No partial, no errors, just output blank form $page->param('form_text' => $form->output()); return $page->output(); } }
In reply to Unexpected behaviour in HTML::FillInForm by jdtoronto
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |