Gossamer Forum
Home : Products : DBMan : Customization :

Don't show records when they are blank

Quote Reply
Don't show records when they are blank
Hi,

I want to do the following:

I ask a user a couple of things, like name, age, gender, homepage en e-mailaddress. If they leave the homepage-field blank (or just with htpp:// in it, like in the example), I don't want to see the 'homepage'-item in the 'View'-option. So that, if I search, I don't get a hyperlink to http:// (when the user left it blank). Is it possible?

------------------
Jan
Quote Reply
Re: Don't show records when they are blank In reply to
First, in order to do this, you cannot use the autogenerate feature of DBMan. You will have to create your own html_record subroutine.

Within html_record, use the following

Code:
|; # to close off any previous print qq| statement
if (length($rec{'homepage'})>7) {
print qq|<a href="$rec{'homepage'}">$rec{'homepage'}</a>|;
}
print qq|

If there are other fields that might be left blank, but don't have a default value like your "homepage" field does, use

Code:
|;
if ($rec{'fieldname'}) {
print qq|$rec{'fieldname'}|;
}
print qq|


------------------
JPD