
Jasmine
Administrator
Apr 12, 2000, 7:53 AM
Post #4 of 6
(475 views)
|
What I do to prevent someone from entering a field full of spaces (which would make $field1 eq "" false is): <BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR> ($temp = $field1) =~ s/ //g; unless($temp){print "You need to fill in this field} </pre><HR></BLOCKQUOTE> But even this doesn't help if they filled out a zero, and a zero is a valid entry. So, the best way to check if anything at all is entered in the field is to see if it's defined. <BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR> ($temp = $field1) =~ s/ //g; unless(defined($temp)){print "You need to fill in this field} </pre><HR></BLOCKQUOTE> The above does not alter the value of $field1 and it allows a value of 0 to be entered.
|