Philip Mak wrote:
Is it all right to use $Request->{Form}? Directly using this variable
seems to be an undocumented feature, but I found it useful recently:
It makes $Response->{FormFill} more flexible because now rather than
only being able to re-populate the form with data that the user just
entered, I can also re-populate the form from a database record
(useful for editing things in the database).

For example:

my $id = int($Request->Params('id'));
my $submission = $dbh->selectrow_hashref("SELECT * FROM submissions WHERE id = $id");
$Response->{FormFill} = 1;
$Request->{Form} = $submission;
# HTML code for the form goes below

I would not recommend doing this exactly as you have done.  What I would
do rather is repopulate the $Form hashref, but keep the blessed object
reference as it, so:

  %{$Request->{Form}} = %$submission;

while its OK to access $Request->{Form} directly, what may not be OK
in the future is to change the class that that hash is blessed into.

Regards,

Josh

________________________________________________________________
Josh Chamas, Founder                   phone:925-552-0128
Chamas Enterprises Inc.                http://www.chamas.com
NodeWorks Link Checking                http://www.nodeworks.com


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to