once again THANKS..
wow. great support.
we went from having our own inhouse crap assed framework, to CGI:App.
i'm delited ;)
On Mon, 21 Mar 2005 14:30:36 -0500, Cees Hek <[EMAIL PROTECTED]> wrote:
> On Mon, 21 Mar 2005 13:49:45 -0500, Michael Peters
> <[EMAIL PROTECTED]> wrote:
> > This doesn't answer the question of how to duplicate the sticky form
> > behavior of ValidateRM. He'd still have to use HTML::FillInForm. So
> > something like:
> >
> > # if we got to this point, we have valid input, so we should insert it.
> > my $bookid = _bookPool_do($q->param('bookid'), yada yada);
> > if (!$bookid) {
> > my $error_page = $self->bookPool( { 'db_error' => 1 } );
> > my $fif = HTML::FillInForm->new();
> > return $fif->fill(
> > scalarref => \$error_page,
> > fobject => $self->query
> > );
> > } else {
> > # return success
> > }
>
> Since I use HTML::FillInForm so much, I usually turn the above into a
> helper function to simplify things:
>
> # if we got to this point, we have valid input, so we should insert it.
> my $bookid = _bookPool_do($q->param('bookid'), yada yada);
> if (!$bookid) {
> return $self->fillinform($self->bookPool( { 'db_error' => 1 } ));
> } else {
> # return success
> }
>
> sub fillinform {
> my $self = shift;
> my $html = shift;
> my $data = shift;
>
> my $fif = new HTML::FillInForm;
> if (ref $data eq 'HASH') {
> return $fif->fill(scalarref => $html,
> fdat => $data,
> @_);
> } elsif (ref $data) {
> return $fif->fill(scalarref => $html,
> fobject => $data,
> @_);
> } else {
> $self->query->delete('rm');
> return $fif->fill(scalarref => $html,
> fobject => $self->query,
> @_);
> }
> }
>
> Just stick that function in your Base class. The function uses
> $self->query by default so you don't have to worry about passing in
> any data besides the actual HTML (but you can if you need to). The
> HTML needs to be passed in as a scalar ref, but I return that by
> default from all my runmodes.
>
> Cheers,
>
> Cees
>
> ---------------------------------------------------------------------
> Web Archive: http://www.mail-archive.com/[email protected]/
> http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
--
Jeff MacDonald
http://www.halifaxbudolife.ca
---------------------------------------------------------------------
Web Archive: http://www.mail-archive.com/[email protected]/
http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]