Gossamer Forum
Home : Products : DBMan : Customization :

Requiring More than One Character

Quote Reply
Requiring More than One Character
I use an if statement in my html.pl to decide whether or not a certain form was filled out. For example:
if ($rec{'allposter'}) {
print qq|<img border="0" src="http://www.movielocity.com/images/blackline.gif" width="144" height="1">
<a href="http://www.allposters.com/link/redirect.asp?
Purchase the poster from Allposters.com</a>|;
It is supposed to see if there is any data in the allposter field and then display it if there is and disregard if there isn't any data. Problem is, the database keeps entering a blank space in this field, so it thinks that something is there when there isn't.

Is there a way in the if statement that I can require it to have 3 or more characters to display? Or have it not display anything if only a space is existent?

I hope this make sense. If not, reply and I'll get an e-mail and clarify it.

=Blake Kunisch=

Quote Reply
Re: Requiring More than One Character In reply to
You can set a minimum length for the field before it is displayed:

if (length($rec{'allposter'}) >= 3) {

I'm not sure why it's saving a space to the database.

If you would like to be sure what exactly is being saved, try adding the following after the code you posted (and after changing the first line as I mentioned above):

else { print ord($rec{'allposter'}); }

Then access a record where that field should be empty, but you've been having problems. Let me know what you get.