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

Re: How do I detect and handle empty form fields?

by Russ (Deacon)
on Jul 05, 2000 at 13:24 UTC ( [id://21102]=note: print w/replies, xml ) Need Help??


in reply to How do I detect and handle empty form fields?

my @InvalidFields = grep {not defined CGI::param($_) or CGI::param($_) eq ''} CGI::param +();

@InvalidFields will now contain the names of any empty fields.

Evaluate @InvalidFields in a scalar context to see how many empty fields there are.
if (@InvalidFields){ # You have some empty fields, so do something about them }

This general technique will work even if you are not using CGI...

Russ

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (8)
As of 2024-04-18 12:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found