Gossamer Forum
Home : Products : DBMan : Customization :

do NOT skip a blank field

Quote Reply
do NOT skip a blank field
I have read through the forum & all the posts I come up with is how to not skip a blank field.

I have a situation on the database I am making where when I set up a member I may not know the actual date they joined (some joined over 10 years ago). I still need the date column to print, even if left blank.

I use JPD's formatter when I made this. The database works fine if I have it "skip fields". I tried going back and starting over by making the date "not required" and then checking do NOT skip blank fields. When I did that I cannot log in and get an internal error.

Any ideas?

Thanks Sly
Diana Rae
Quote Reply
Re: [dianarae] do NOT skip a blank field In reply to
Hopefully you kept a backup copy before making changes. If so, you can just make the change in the .cfg file as to whether it's required.

And in your html.pl file to have it display the field regardless just remove the if statement used as the condition of whether it should be displayed.





Unoffical DBMan FAQ

http://creativecomputingweb.com/dbman/index.shtml/
Quote Reply
Re: [LoisC] do NOT skip a blank field In reply to
In Reply To:
"Hopefully you kept a backup copy before making changes. If so, you can just make the change in the .cfg file as to whether it's required."

I sure did! Cool I make copies of every single change (call me paranoid).Wink "And in your html.pl file to have it display the field regardless just remove the if statement used as the condition of whether it should be displayed."

Sorry to sound naive, but in which sub might I find that if statement? Crazy

Diana Rae
Quote Reply
Re: [dianarae] do NOT skip a blank field In reply to
In your sub html_record is where your record would be displayed.

If you wanted the display to hide fields that are blank you would use for instance:

=> if ($rec{'Summary'}) { print qq|<B>Brief Description:</B><BR>$rec{'Summary'}<P> |;}

If you wanted to display this field even if there isn't anything within the field you would just display:

=> <B>Brief Description:</B><BR>$rec{'Summary'}<P>

I use limited table tags but the example should help you to see the difference.


Unoffical DBMan FAQ

http://creativecomputingweb.com/dbman/index.shtml/
Quote Reply
Re: [dianarae] do NOT skip a blank field In reply to
What do you mean "checking" do not skip blank fields?

In my cfg-file, there's a value $db_skip_blank. Set it to zero, or delete it, and then the blank fields will not be skipped.
kellner
Quote Reply
Re: [kellner] do NOT skip a blank field In reply to
In Reply To:
What do you mean "checking" do not skip blank fields?

In my cfg-file, there's a value $db_skip_blank. Set it to zero, or delete it, and then the blank fields will not be skipped.


The box in the configurator where you choose to the box to have blank fields or not.

I have looked everywhere in my cfg file (in every one I have) and none have a $db_skip_blank value - I even did a search. Is this something I must manually add? If so, where?
Diana Rae
Quote Reply
Re: [dianarae] do NOT skip a blank field In reply to
I don't know how the configurator works. Check whether your db.cgi does anything with $db_skip_blank (presumably in the subroutine build_html_record). If so, add this line to your cfg-file:

$db_skip_blank = 1;

Note that this will only work when you have auto generation of html_record enabled. Otherwise you'll have to do some manual coding Wink
kellner
Quote Reply
Re: [kellner] do NOT skip a blank field In reply to
Yup. Unimpressed I finally found something about it, but it requires that you have the autogenerate set to on. I don't want it on. Unsure I have done LOTS of my own html in there.Pirate

And I do have it set to allowing to leave it blank, but when I do leave the field blank the border will not print. *sigh* Frown
Diana Rae

Last edited by:

dianarae: Jan 15, 2002, 3:27 PM
Quote Reply
Re: [dianarae] do NOT skip a blank field In reply to
I think showing you will explain better:

http://www.aallsafe.com/NOR/roster/test/test.cgi?db=test&uid=default&ID=&Status=MIA&Name=&Rank=---&Email=&Joined=&Promoted=&keyword=&mh=50&sb=4&so=ascend&view_records=Search+Records

As you can see with every field that I have not filled in a date the border will not show. Is this fixable?
Diana Rae
Quote Reply
Re: [dianarae] do NOT skip a blank field In reply to
I suppose if you print "&nbsp;" for every empty value, the border would show, no?

if ($rec{'Rank'}) { print qq|$rec{'Rank'}|;} else { print qq|&nbsp;|;}
kellner
Quote Reply
Re: [kellner] do NOT skip a blank field In reply to
Kellner,

You are truly a gentleman & a scholar. Wink

I used the code & played around with it and finally got the "Joined" column to work.

Take a look:

http://www.aallsafe.com/NOR/roster/test/test.cgi?db=test&uid=default&ID=&Status=MIA&Name=&Rank=---&Email=&Joined=&Promoted=&keyword=&mh=50&sb=4&so=ascend&view_records=Search+Records

However, no matter what I do I just cannot seem to get the end column "Promoted" to work (I am still trying mind you).

Here is the current code the changes you gave me in red and as I said, the Joined column does work, but somewhere I am missing something on the Promoted column:

sub html_record {
# --------------------------------------------------------
# How a record will be displayed. This is used primarily in
# returning search results and how it is formatted. The record to
# be displayed will be in the %rec hash.

my (%rec) = @_; # Load any defaults to put in the VALUE field.
($db_auto_generate and print &build_html_record(%rec) and return);

my $font_color = 'Font face="Verdana, Arial, Helvetica" Size=2 Color=#003399';
my $font = 'Font face="Verdana, Arial, Helvetica" Size=2';

$url{'Email'} = $rec{'Email'};
$url{'Email'} =~ s/<\/?B>//g;

print qq|
<TABLE WIDTH="100%" CELLPADDING=0 CELLSPACING=0 BORDER=1 BGCOLOR="#EDDECD">
<tr> <td width="10%" align="left" bgcolor="#BF9686"><font face="Arial" size="2"><b>Name</b></font></TD>
<td width="13%" align="center" bgcolor="#BF9686"><font face="Arial" size="2"><b>Rank</b></font></TD>
<td width="18%" align="center" bgcolor="#BF9686"><font face="Arial" size="2"><b>Email</b></font></TD>
<td width="9%" align="center" bgcolor="#BF9686"><font face="Arial" size="2"><b>Joined</b></font></TD>
<td width="9%" align="center" bgcolor="#BF9686"><font face="Arial" size="2"><b>Promoted</b></font></TD></TR>
</TABLE>
|;
print qq|
<TABLE WIDTH="100%" CELLPADDING=0 CELLSPACING=0 BORDER=1 BGCOLOR="#EDDECD">|;
if ($per_admin) {
print qq|
<TR><td width="2%" align="center"><font face="Arial" size="2">$rec{'ID'}</Font></TD>
|;
}
print qq||;
if ($per_admin) {
print qq|
<td width="7%" align="center"><font face="Arial" size="2">$rec{'Status'}</Font></TD>
|;
}
print qq||;
if ($per_admin) {
print qq|
<td width="9%" align="center"><font face="Arial" size="2">$rec{'Barony'}</Font></TD>
|;
}
if ($rec{'Rank'} =~ /^(\d+)(\w+)$/) { $rec{'Rank'} = $2;} {
print qq|
<td width="10%" align="left"><font face="Arial" size="2">$rec{'Name'}</Font></TD>
<td width="13%" align="center"><font face="Arial" size="2">$rec{'Rank'}</Font></TD>
<td width="18%" align="center"><font face="Arial" size="2"><a href="mailto:$url{'Email'}">$rec{'Email'}</a>|;
if ($rec{'Joined'}) {
print qq|
<td width="9%" align="center"><font face="Arial" size="2">$rec{'Joined'}</Font></TD>
|;
}
else {
print qq|
<td width="9%" align="center"><font face="Arial" size="2">&nbsp;</Font></TD>
|;
}
if ($rec{'Promoted'}) {
print qq|
<td width="9%" align="center"><font face="Arial" size="2">$rec{'Promoted'}</Font></TD>
|;
}
else {
print qq|
<td width="9%" align="center"><font face="Arial" size="2">&nbsp;</Font></TD></TR>
|;
}
print qq|
</TABLE>
|;
}
}


Any ideas would be most appreciated.
Diana Rae
Quote Reply
Re: [dianarae] do NOT skip a blank field In reply to
Gentlewoman, actually Wink

In the line removing the number of $rec{'Rank'}, there's an opening brace at the end which you don't need, and at the end of html_record, there's a closing brace that you don't need. You only need one at the end of html_record. Other than that, I can't spot what could be wrong.
kellner
Quote Reply
Re: [kellner] do NOT skip a blank field In reply to
Well, don't *I* feel silly. Angelic

Of course you are a woman. Cool

Anyhow, I did what you said & removed those extra brackets:

sub html_record {
# --------------------------------------------------------
# How a record will be displayed. This is used primarily in
# returning search results and how it is formatted. The record to
# be displayed will be in the %rec hash.

my (%rec) = @_; # Load any defaults to put in the VALUE field.
($db_auto_generate and print &build_html_record(%rec) and return);

my $font_color = 'Font face="Verdana, Arial, Helvetica" Size=2 Color=#003399';
my $font = 'Font face="Verdana, Arial, Helvetica" Size=2';

$url{'Email'} = $rec{'Email'};
$url{'Email'} =~ s/<\/?B>//g;

print qq|
<TABLE WIDTH="100%" CELLPADDING=0 CELLSPACING=0 BORDER=1 BGCOLOR="#EDDECD">
<tr> <td width="10%" align="left" bgcolor="#BF9686"><font face="Arial" size="2"><b>Name</b></font></TD>
<td width="13%" align="center" bgcolor="#BF9686"><font face="Arial" size="2"><b>Rank</b></font></TD>
<td width="18%" align="center" bgcolor="#BF9686"><font face="Arial" size="2"><b>Email</b></font></TD>
<td width="9%" align="center" bgcolor="#BF9686"><font face="Arial" size="2"><b>Joined</b></font></TD>
<td width="9%" align="center" bgcolor="#BF9686"><font face="Arial" size="2"><b>Promoted</b></font></TD></TR>
</TABLE>
|;
print qq|
<TABLE WIDTH="100%" CELLPADDING=0 CELLSPACING=0 BORDER=1 BGCOLOR="#EDDECD">|;
if ($per_admin) {
print qq|
<TR><td width="2%" align="center"><font face="Arial" size="2">$rec{'ID'}</Font></TD>
|;
}
print qq||;
if ($per_admin) {
print qq|
<td width="7%" align="center"><font face="Arial" size="2">$rec{'Status'}</Font></TD>
|;
}
print qq||;
if ($per_admin) {
print qq|
<td width="9%" align="center"><font face="Arial" size="2">$rec{'Barony'}</Font></TD>
|;
}
if ($rec{'Rank'} =~ /^(\d+)(\w+)$/) { $rec{'Rank'} = $2;}
print qq|
<td width="10%" align="left"><font face="Arial" size="2">$rec{'Name'}</Font></TD>
<td width="13%" align="center"><font face="Arial" size="2">$rec{'Rank'}</Font></TD>
<td width="18%" align="center"><font face="Arial" size="2"><a href="mailto:$url{'Email'}">$rec{'Email'}</a>|;
if ($rec{'Joined'}) {
print qq|
<td width="9%" align="center"><font face="Arial" size="2">$rec{'Joined'}</Font></TD>
|;
}
else {
print qq|
<td width="9%" align="center"><font face="Arial" size="2">&nbsp;</Font></TD>
|;
}
if ($rec{'Promoted'}) {
print qq|
<td width="9%" align="center"><font face="Arial" size="2">$rec{'Promoted'}</Font></TD>
|;
}
else {
print qq|
<td width="9%" align="center"><font face="Arial" size="2">&nbsp;</Font></TD></tr>
|;
}
print qq|
</TABLE>
|;
}


And even though the "Joined" column now does work, the "Promoted" still will not. *sigh*

If you cannot see anything wrong (and I have tried it about 50 different ways now) I guess I am stuck with it the way it is now. Unimpressed
Diana Rae