in reply to Sticky Forms
It is true that CGI has sticky form elements by default. Your problem is that nobody has explained exactly what is meant, in this situation, by "sticky form elements." So let me give it a shot.
At a basic level, CGI.pm's stickiness consists of exactly this: when you submit a form, via GET or POST, to a script that uses the functions (or methods) defined in the module CGI both to parse its input and to generate a new form in its output, then form elements in the output that have the same name as form elements that were parsed as part of the input will, unless otherwise specified (usually using the -value and -force arguments to the code-generating method or subroutine), be pre-populated with the values that they had in the incoming GET or POST request.
Clear as mud? Was afraid of that...
To put it in more relevant terms for you: for your form to be pre-populated with the values from a previous invocation, the script has to get those values from the browser when it's called. So your strategy of having a separate script to validate, with a simple hard-coded link back to the original script for corrections, cannot possibly work. However, you have various options that can work, with greater or lesser amounts of work on your part:
(Please note that the above is not in any way tested.)my $hidden_form = $cgi->start_form( -name=>"resubmission, -method=>"POST", -action=>$input_cgi_location, ); foreach my $p ($cgi->param) { $hidden_form .= $cgi->hidden($p); } $hidden_form .= $cgi->submit( -name=>"resubmitted", -value=>"Return to input form", ); $hidden_form .= $cgi->end_form;
I hope some of that was helpful—good luck!
|
---|