Bug 14898

Summary: need way to prepopulate checkbox and multi-select fields on error
Product: Red Hat Web Site Reporter: Maraya Cornell <maraya>
Component: OtherAssignee: Tom Lancaster <tlancast>
Status: CLOSED CURRENTRELEASE QA Contact: Paul Lindner <plindner>
Severity: medium Docs Contact:
Priority: medium    
Version: current   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
URL: http://www.redhat.com/strategicservices/contactform/
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2000-08-11 23:20:22 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Maraya Cornell 2000-07-31 18:01:18 UTC
Regarding the form pane, /apps/formmail/.  When the user makes a mistake on 
a required field, he gets the form back with a message.  The pane allows 
Production to add some code to the form itself so that the form fields are 
prepopulated, and the user doesn't have to fill them all out again.  Except 
that there's no way to do this for checkboxes and multiselects.  This 
feature really does't do us much good unless we can prepopulate ALL of the 
fields.

Comment 1 Paul Lindner 2000-08-09 08:45:32 UTC
Tom, a hint from the modperl list....

See me about a way to use this idea with nifty Apache::ASP custom tags..



There is the HTML::FillInForm module that will pre fill your forms.
It is pure Perl.  It seems to work well, haven't stress tested it yet.

I am using it in conjunction with Apache::ASP, but haven't hacked
the Apache::ASP module to include it as a function.  It is much easier
to work with now that Joshua has added the $Response->TrapInclude
function (thank you).  I just keep my form in an include file, read it in to
my script/page
with the $Response->TrapInclude then send the it through HTML::FillInForm
with my values I want in the form.

This is all it takes -
use HTML::FillInForm;

my $fif = new HTML::FillInForm;

my $html = $Response->TrapInclude('dbd_form.inc');

my $output = $fif->fill(scalarref => $html,
                  fdat => \%form_content);

print "$output";


Comment 2 Tom Lancaster 2000-08-10 20:46:36 UTC
Fixed this using the Module Paul recommended HTML::FillInForm, though it needed
some patching to work properly on upper case HTML and checkboxes.
The new custom tag which should be used for forms needing this functionality is
<Apps:fillin></Apps:fillin>. This should surround the <form></form> tags.
I have applied this to the pages in apps/response ( the oracle and IA64 contact
forms ).
I noticed in doing this that the checkboxes on oracle_81contact.html didn't
appear to be right; there's a series of them with the same name and different
values, a la radio button. I'm not sure you're supposed to do that with
checkboxes. Correct me if I'm wrong, though.

I'll submit a separate bug for that one.

Comment 3 Maraya Cornell 2000-08-11 23:20:20 UTC
This isn't working for me. I've tried it with and without the perl code in the 
page. I think it's supposed to be without. I noticed that the <Apps:fillin> and <
/Apps:fillin> are still showing up in the source - shouldn't they have 
disappeared? Maybe something needs to be done to my sandbox to make that work?

I committed the page I'm working on:
http://sassy.soma.redhat.com:8500/apps/response/enroll_channel.html


Comment 4 Tom Lancaster 2000-08-11 23:38:51 UTC
I tihnk /apps/global.asa
and /home/httpd/lib/HTML/FillInForm ( plus HTML::Parser )
need to be updated on that machine. Paul??

Comment 5 Maraya Cornell 2000-08-11 23:55:52 UTC
No, those files are already updated. Are there any others I may be missing?