Gossamer Forum
Home : Products : DBMan : Customization :

Link a record field to a single long record

Quote Reply
Link a record field to a single long record
I need to have one field in the record be a link to a long version of that record. I'm having a problem creating a link if the $field = CompanyName. Here is a sample of my code:
sub build_html_record {
# --------------------------------------------------------
# Builds a record based on the config information.
#
my (%rec) = @_;
my ($output, $field);
my ($thisfield);

$output = "<tr>";
foreach $field (@db_cols) {
next if (($db_form_len{$field} == -1) or ($db_form_len{$field} == -2));
if ($field == 'CompanyName') {
$output .= qq~<td align=center><a href="$db_script_link_url&view_details=1&ID=$rec{'ID'}"><$font>$rec{$field}</font></a></td>
~;
}
else {

$output .= qq~<td align=center><$font>$rec{$field}</font></td>
~;
}


# $output .= qq~<tr><td align=right valign=top width=20%><$font>$field:</font></td>
# <td width=80%><$font>$rec{$field}</font></td></tr>
# ~;
}
$output .= "</tr>\n";
return $output;
}

It makes every record a link instead of just the CompanyName record. Any advice?

Thanks,
Rick Guyer
Quote Reply
Re: Link a record field to a single long record In reply to
Another note. I must use the auto_generate because the database will need to be easily changed in the future. So that knocks out the possibility of just modifying html_record.
Quote Reply
Re: Link a record field to a single long record In reply to
You need to use

Code:
if ($field eq 'CompanyName') {

The "==" comparison operator is for numbers. The "eq" comparison operator is for text.



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






Quote Reply
Re: Link a record field to a single long record In reply to
I should have known that. Thank you.