Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Confirmation page using HTML::Template & CGI::Application

by jeffa (Bishop)
on Feb 02, 2004 at 14:51 UTC ( #325864=note: print w/replies, xml ) Need Help??


in reply to Confirmation page using HTML::Template & CGI::Application

First, don't rely on JavaScript alone for form validation. JavaScript validation can be easily bypassed because the server can be accessed directly by bots (and WWW::Mechanize makes the task even easier).

Personally, i would instead use JavaScript as the confirmation page, because you still have to validate what they confirmed! Personally, i think that confirmation pages are only necessary for the deletion of records. But, having said all of that, here is some HTML::Template code that will display a confirmation page -- the trick is using hidden form fields.

use strict; use warnings; use CGI; use HTML::Template; my $q = CGI->new; my $tmpl = HTML::Template->new( filehandle => \*DATA, associate => $q, ); print $q->header, $q->start_html; if ($q->param('cmd') eq 'confirm') { print $q->p("the user confirmed"); } else { print $tmpl->output; } __DATA__ <tmpl_if cmd> You submitted: <ol> <li>foo: <tmpl_var foo></li> <li>bar: <tmpl_var bar></li> </ol> You like? <form> <input type="hidden" name="cmd" value="confirm" /> <input type="submit" value="yes" /> </form> <tmpl_else> <form> foo: <input type="text" name="foo" /><br/> bar: <input type="text" name="bar" /><br/> <input type="hidden" name="cmd" value="ask" /> <input type="submit" /> </form> </tmpl_if>

jeffa

L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
B--B--B--B--B--B--B--B--
H---H---H---H---H---H---
(the triplet paradiddle with high-hat)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://325864]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2020-02-24 00:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What numbers are you going to focus on primarily in 2020?










    Results (104 votes). Check out past polls.

    Notices?