Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Pre-Populate HTML form

by linebacker (Scribe)
on Jan 22, 2003 at 20:12 UTC ( [id://229121]=note: print w/replies, xml ) Need Help??


in reply to Pre-Populate HTML form

Seems like you also might just use the CGI.pm with default values. Psuedo-code (basically just Lincoln Stein CGI documentation ) follows:
#!/usr/local/bin/perl use CGI qw(:standard); print header; print start_html('Lincoln Stein Rocks the Perlmonk Example'), h1('Perlmonk Example'), start_form, "What's the combination?",p, checkbox_group(-name=>'words', -values=>'eenie','meenie','minie','moe'],
-defaults=>['eenie','minie']),
p, "What's your favorite color? ", popup_menu(-name=>'color', -values=>'red','green','blue','chartreuse']), p, submit, end_form, hr; print end_html;

Replies are listed 'Best First'.
Re^2: Pre-Populate HTML form
by Aristotle (Chancellor) on Jan 22, 2003 at 22:18 UTC
    Mixing HTML, even in its CGI-function-conceiled form, with code in this way is almost never a good idea, though. I've found that even in cases of small scripts where I started out like this, I'd've been better served to opt for a template(ish) solution right off the bat. On the other hand, ever since I got into the habit of doing that, I've never found myself wishing I hadn't put forth the effort to separate out the HTML. The reason is scalability - templates are easier to grow complexity into as you go, which is important CGI scripts tend not to be one-off, throw-away solutions. Rather, even in simple ones tend to hang around for significant periods of time, and I've found that nearly every single one of them eventually grew. If not by much, then still enough so to make matters of initial organization important down the road.

    Makeshifts last the longest.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2024-04-25 05:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found