in reply to How do I detect and handle empty form fields?
This is how i have been dealing with empty form fields:
# If certain fields are blank, then give a "blank form" response &missing_info_error ("Date") unless $FORM{'date'}; &missing_info_error ("Name") unless $FORM{'name'}; &missing_info_error ("Eng/Rig") unless $FORM{'engorrig'}; &missing_info_error ("Engine Model") unless $FORM{'em'}; &missing_info_error ("Test Stand or Build Cell") unless $FORM{'tsbc'}; &missing_info_error ("Time Lost") unless $FORM{'tl'};
Then output is in a HTML page
Update: mandog raised the issue that this approach fails if a legitimate field value is zero. In such cases, a missing field error is posted, even though the field exists, thus reinforcing the case for using CGI.pm
Edited by davido: Added code tags. Removed duplicate submission. Directed readers to further clarification.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Answer: How do I detect and handle empty form fields?
by mandog (Curate) on Oct 02, 2003 at 18:45 UTC |
In Section
Seekers of Perl Wisdom