Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Sticky Forms

by reasonablekeith (Deacon)
on Apr 16, 2007 at 09:33 UTC ( #610302=note: print w/replies, xml ) Need Help??


in reply to Sticky Forms

You just need to save the value and restore it to your input fields someway.

Where you're actually keeping the data (server-side data against a session, posted form paramters etc... ) would determine the method. Here's a simple example with posted data. Firstname is sticky after the form is submitted, surname isn't.

#!/usr/bin/perl use CGI; use CGI::Carp qw(fatalsToBrowser); use warnings; use strict; my $q = new CGI; my $firstname = $q->param('firstname'); print qq|content-type: text/html\n\n|; print qq|<form action="$ENV{SCRIPT_NAME}" method="post" name=f>\n|; print qq|<input name="firstname" type="text" value="$firstname"/><hr/> +|; print qq|<input name="surname" type="text"/><hr/>|; print qq|<input type="submit" name="form_submit" value="go">|;
---
my name's not Keith, and I'm not reasonable.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (2)
As of 2022-08-14 14:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?