three-part form submission using CGI.pm 
Author Message
 three-part form submission using CGI.pm

I've been poring over the web-docs, and the pod for CGI.pm but I can't
quite seem to find a simple method for passing the form's parameters a
*third* time

stage 1
    user inputs form data into template.cgi

stage 2
    we display the input (and do some checking), and then offer an
"approved" button to again pass the values to template.cgi for
processing in stage 3

stage 3
    we use the input values to create two templates in txt and html
format that are subsequently e-mailed to the user as attachments via
MIME::Lite.

the problem is, that when the user 'validates' his data, in stage 2,
stage 3 never recieves all the param() items that stage 2 did.

how do I accomplish this?

I realize I could use cookies, or some form of saved/stored file to do
this (and that CGI.pm provides the hooks for this), but that seems like
overkill when all I want to do is include all the current param() items
in the next form submission without having to build a multiplicity of
hidden fields in order to do so (which I could probably do with a map
function but it again seems like overkill) or setting cookies or
savefiles (avoiding savefiles means I don't have to code around race
conditions).

I'm just not sure of the perl code that wuld be required to tell CGI.pm
to include all the previous param() input with the 2nd submission.

Anyone have a pointer?

--
unmunge e-mail here:
#!perl -w
print map {chr(ord($_)-3)} split //, "zhepdvwhuCzhegudjrq1qhw";
# ( damn spammers. *shakes fist* take a hint. =:P )



Tue, 05 Aug 2003 03:03:13 GMT  
 three-part form submission using CGI.pm

Make a bunch of hidden fields for the information in the 2nd form doing
this.

foreach $param (param){$hiddeninfo .= hidden($param)."\n";}

Then on your 3rd submission you will have the same field names and
stuff you need.

B. Carlson

Quote:

> I've been poring over the web-docs, and the pod for CGI.pm but I can't
> quite seem to find a simple method for passing the form's parameters a
> *third* time

> stage 1
>     user inputs form data into template.cgi

> stage 2
>     we display the input (and do some checking), and then offer an
> "approved" button to again pass the values to template.cgi for
> processing in stage 3

> stage 3
>     we use the input values to create two templates in txt and html
> format that are subsequently e-mailed to the user as attachments via
> MIME::Lite.

> the problem is, that when the user 'validates' his data, in stage 2,
> stage 3 never recieves all the param() items that stage 2 did.

> how do I accomplish this?

> I realize I could use cookies, or some form of saved/stored file to do
> this (and that CGI.pm provides the hooks for this), but that seems like
> overkill when all I want to do is include all the current param() items
> in the next form submission without having to build a multiplicity of
> hidden fields in order to do so (which I could probably do with a map
> function but it again seems like overkill) or setting cookies or
> savefiles (avoiding savefiles means I don't have to code around race
> conditions).

> I'm just not sure of the perl code that wuld be required to tell CGI.pm
> to include all the previous param() input with the 2nd submission.

> Anyone have a pointer?

> --
> unmunge e-mail here:
> #!perl -w
> print map {chr(ord($_)-3)} split //, "zhepdvwhuCzhegudjrq1qhw";
> # ( damn spammers. *shakes fist* take a hint. =:P )



Tue, 05 Aug 2003 03:31:14 GMT  
 three-part form submission using CGI.pm

[jeopardectomy performed]

 | Make a bunch of hidden fields for the information in the 2nd form doing
 | this.
 |
 | foreach $param (param){$hiddeninfo .= hidden($param)."\n";}
 |
 | Then on your 3rd submission you will have the same field names and
 | stuff you need.
 |
 | B. Carlson

it seems to me that if I have to do it this way, that a map would be
more efficient.

I don't quite grok the map function yet (although I can definitely feel
the need to) .. I'm going to take a whack at this right here off the top
of my head, and invite some critique from you more experienced map-ers

print header, start_html, start_form,
    ( map {
          hidden({-name=>$_, -Values=>unescapeHTML(param($_))})
          } (param)
     ),
    submit(), end_form, end_html;

I tried this, and played with it a bit, and it otherwise seems to work
fine, but it introduces another problem..

I have some textarea fields that I want the users to be able to input in
paragraph format and preserve the line breaks (for which I was using a
fix_paragraphs() sub that replaces all the \n's with <br>'s instead)

however when I view the 'intermediate preview', all the \n's are
HTML-escaped by CGI.pm to be &#13;&#10; pairs (and I'm not even sure
whether this is localized to being on a Mac, or if that's normal.)

I've tried adding those to the fix_paragraphs sub in a separate regex
but it's not catching them. any suggestions on this?

--
send mail to webmaster (at) webdragon (dot) net instead of the above address.
this is to prevent spamming. e-mail reply-to's have been altered
to prevent scan software from extracting my address for the purpose
of spamming me, which I hate with a passion bordering on obsession.  



Tue, 05 Aug 2003 06:51:53 GMT  
 three-part form submission using CGI.pm
$cgi->hidden() will work for this.

HTML::Embperl is my suggestion for heavy-duty jobs

Quote:

> I've been poring over the web-docs, and the pod for CGI.pm but I can't
> quite seem to find a simple method for passing the form's parameters a
> *third* time

> stage 1
>     user inputs form data into template.cgi

> stage 2
>     we display the input (and do some checking), and then offer an
> "approved" button to again pass the values to template.cgi for
> processing in stage 3

> stage 3
>     we use the input values to create two templates in txt and html
> format that are subsequently e-mailed to the user as attachments via
> MIME::Lite.

> the problem is, that when the user 'validates' his data, in stage 2,
> stage 3 never recieves all the param() items that stage 2 did.

> how do I accomplish this?

> I realize I could use cookies, or some form of saved/stored file to do
> this (and that CGI.pm provides the hooks for this), but that seems like
> overkill when all I want to do is include all the current param() items
> in the next form submission without having to build a multiplicity of
> hidden fields in order to do so (which I could probably do with a map
> function but it again seems like overkill) or setting cookies or
> savefiles (avoiding savefiles means I don't have to code around race
> conditions).

> I'm just not sure of the perl code that wuld be required to tell CGI.pm
> to include all the previous param() input with the 2nd submission.

> Anyone have a pointer?

> --
> unmunge e-mail here:
> #!perl -w
> print map {chr(ord($_)-3)} split //, "zhepdvwhuCzhegudjrq1qhw";
> # ( damn spammers. *shakes fist* take a hint. =:P )



Tue, 05 Aug 2003 08:04:08 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. three-part form submission using CGI.pm

2. Looking for examples using cgi.pm or form.pm

3. generating a HTML form using CGI.pm

4. CGI.pm passing hash as value from form to form

5. problem with CGI.pm and textarea in multipart/form-data forms

6. processing the Drop Down Menu (form part) using Perl script

7. Combined CGI Forms with CGI.pm

8. Three-argument form of open() and I/O disciplines

9. Three-argument form of open() and I/O disciplines

10. Printing while simultaneously using CGI.pm and Mail::Internet.pm

11. How to expire a cgi page using CGI.pm

12. Problems with http file upload using cgi.pm and cgi-lib.pl

 

 
Powered by phpBB® Forum Software