Gossamer Forum
Home : Products : DBMan : Customization :

text area fields

Quote Reply
text area fields
How can you setup a text area field so that when someone enters data into this field, it will keep its format when being displayed. (i.e., new paragraphs, line breaks and spacing)? Instead of just compacting altogether.....

Any help would be greatly appreciated Smile
Quote Reply
Re: text area fields In reply to
In sub html_record, just after

my (%rec) = _@;

add

Code:
$rec{'fieldname'} =~ s/\n/<BR>/g;

Replace fieldname with the name of your field.


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





Quote Reply
Re: text area fields In reply to
This is what I put and it did not work.

sub html_record {
# THE NEW ONE FOR DISPLAYING --------------------------------------------------------
# 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.
<b>$rec{'resume'} =~ s/\n/<BR>/g;</b>
($db_auto_generate and print &build_html_record(%rec) and return);

print qq|
<TABLE WIDTH="400" table border="1" cellpadding="1" cellspacing="1"
bgcolor="#F1F1F1" bordercolor="#008000" bordercolordark="#008080"
bordercolorlight="#FFFFFF">
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="20%"><$font_color>ID:</FONT></TD>
<td>$rec{'ID'}</td></tr>|;
print qq|
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="20%"><$font_color>Date:</FONT></TD>
<td>$rec{'Date'}</td></tr>|;
if ($rec{'Messages'}) {
print qq|
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="20%"><$font_color>Message Center Username:</FONT></TD>
<td><a href="http://www.apartmentjobz.com/cgi-bin/email/mailbox.cgi" target="_top">$rec{'Messages'}</td></tr>|;
}
if ($rec{'Name'}) {
print qq|
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="20%"><$font_color>Name:</FONT></TD>
<td>$rec{'Name'}</td></tr>|;
}
if ($rec{'Address'}) {
print qq|
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="20%"><$font_color>Address:</FONT></TD>
<td>$rec{'Address'}</td></tr>|;
}
if ($rec{'City'}) {
print qq|
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="20%"><$font_color>City:</FONT></TD>
<td>$rec{'City'}</td></tr>|;
}
if ($rec{'State'}) {
print qq|
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="20%"><$font_color>State:</FONT></TD>
<td>$rec{'State'}</td></tr>|;
}
if ($rec{'Zip'}) {
print qq|
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="20%"><$font_color>Zip Code:</FONT></TD>
<td>$rec{'Zip'}</td></tr>|;
}
if ($rec{'Email'}) {
print qq|
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="20%"><$font_color>Email:</FONT></TD>
<td><a href="mailto:$rec{'Email'}">$rec{'Email'}</td></tr>|;
}
if ($rec{'Phone'}) {
print qq|
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="20%"><$font_color>Phone:</FONT></TD>
<td>$rec{'Phone'}</td></tr>|;
}
if ($rec{'Fax'}) {
print qq|
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="20%"><$font_color>Fax:</FONT></TD>
<td>$rec{'Fax'}</td></tr>|;
}
if ($rec{'Hours'}) {
print qq|
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="20%"><$font_color>Hours:</FONT></TD>
<td>$rec{'Hours'}</td></tr>|;
}
print qq|
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="20%"><$font_color>Relocate:</FONT></TD>
<td>$rec{'Relocate'}</td></tr>|;
print qq|
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="20%"><$font_color>Objective:</FONT></TD>
<td>$rec{'Objective'}</td></tr>|;
print qq|
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="20%"><$font_color>Resume:</FONT></TD>
<td>$rec{'Resume'}</td></tr>|;
if ($rec{'Comments'}) {
print qq|
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="20%"><$font_color>Comments:</FONT></TD>
<td>$rec{'Comments'}</td></tr>|;
}
print qq|
</table>
|;
}


I only inserted at the bold part in the top.
Do you see any problems?
Quote Reply
Re: text area fields In reply to
the message above this I used the wrong ubb code. The part that should be bold is enclosed in the "<b></b>
Quote Reply
Re: text area fields In reply to
What do you mean by "it did not work." Did you get an error? Was there no change in the way the textarea printed out?


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





Quote Reply
Re: text area fields In reply to
On closer inspection, I see what happened.

You have

Code:
$rec{'resume'} =~ s/\n/<BR>/g;

and

Code:
<td>$rec{'Resume'}</td></tr>

Field names are case sensitive. You need to change the first line above to

Code:
$rec{'Resume'} =~ s/\n/<BR>/g;


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





Quote Reply
Re: text area fields In reply to
Jeeze, It's the little things that get me!!! Thanks as always. Your apprentice wannabe