You are viewing a plain text version of this content. The canonical link for it is here.
Posted to asp@perl.apache.org by eamondaly <ea...@fastweb.com> on 2002/03/26 23:30:31 UTC

Trying to patch Apache::ASP::FormFill

I'm stuck on what should be a pretty simple patch to FormFill. We
pass data around via QueryString a lot, so I'd like our form fields
to be prefilled using both $Request->QueryString and $Request->Form.

I was trying a patch like so:

  my $fdat;
  eval { $asp->{Request}{Params} };
  if ($@) {
    $fdat = $asp->{Request}{Form};
    $asp->{dbg} && $asp->Debug("form fill: using $Request->Form");
  }
  else {
    $fdat = $asp->{Request}{Params};
    $asp->{dbg} && $asp->Debug("form fill: using Request->Params");
  }

  eval {
    my $fif = HTML::FillInForm->new();
    $form = $fif->fill(
                       scalarref => \$form,
                       fdat => $fdat
                      );
  };
  ...

This works fine when I add "PerlSetVar RequestParams 1" to httpd.conf.
However, when I remove RequestParams, the "$asp->{Request}{Params}"
eval doesn't throw an error!

If I create a plain old page and call:

  <%
    eval { $Request->Params; };
    print $@ ? "failed: $@" : "succeeded!";
  %>

the trap works just fine. Is there something special about the $asp
object in FormFill?


---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org
For additional commands, e-mail: asp-help@perl.apache.org


Re: Trying to patch Apache::ASP::FormFill

Posted by eamondaly <ea...@fastweb.com>.
> Try this in global.asa:
> 
> sub Script_OnStart {
>   $Request->{Form} = $Request->{Params};
> }
> 
> I would like to keep the FormFill functionality filling from
> the form only so people do not have any unexpected surprises.
> Hopefully the above will work for you.

Works like a dream. Thanks, Joshua. That's /two/ beers I owe you.

________________________________________
Eamon Daly
Director, Web Development - FastWeb, Inc.
(847) 568-6410



---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org
For additional commands, e-mail: asp-help@perl.apache.org


Re: Trying to patch Apache::ASP::FormFill

Posted by Joshua Chamas <jo...@chamas.com>.
eamondaly wrote:
> 
> I'm stuck on what should be a pretty simple patch to FormFill. We
> pass data around via QueryString a lot, so I'd like our form fields
> to be prefilled using both $Request->QueryString and $Request->Form.
> 

Try this in global.asa:

sub Script_OnStart {
  $Request->{Form} = $Request->{Params};
}

I would like to keep the FormFill functionality filling from
the form only so people do not have any unexpected surprises.
Hopefully the above will work for you.

--Josh
_________________________________________________________________
Joshua Chamas                           Chamas Enterprises Inc.
NodeWorks Founder                       Huntington Beach, CA  USA 
http://www.nodeworks.com                1-714-625-4051

---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org
For additional commands, e-mail: asp-help@perl.apache.org