Gossamer Forum
Home : Products : DBMan : Customization :

Carriage Returns in text field

Quote Reply
Carriage Returns in text field
Hey gang.

Got a simple question I hope --- I have a celebrity chat database setup. There is a field for chat information where I copy and paste information.

Heres the trouble -- the information is running scross the field from the first word to the last word with no carriage returns.

I have pasted the info in an organzined manner such:

mnmnmnm
mnnmnmn
ghgh

but its coming out like mnmnmnnm mmnmnmn ghghgh

any idea what controls this?

Quote Reply
Re: Carriage Returns in text field In reply to
From the Resources -> DBMan -> FAQ:
http://www.gossamer-threads.com/...s/Detailed/1035.html

- Mark


Astro-Boy!!
http://www.zip.com.au/~astroboy/
Quote Reply
Re: Carriage Returns in text field In reply to
I believe this change is to be made into html.pl file (my html file has been reworked for ssi - so now its called html_ssi.pl)....and if the adding of the $rec{'fieldname'} =~ s/\n/<BR>/g;

I will asume since my field name is called ChatInfo, the command line will read as:

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

I believe I made the change -- but im still getting the same problem

Quote Reply
Re: Carriage Returns in text field In reply to
Did you add the code under the line my (%rec) = @_;?

Has your html_record sub-routine changed much for ssi? I doubt it would cause too much concern though...

If you still get stuck, could you post the sub-routine? We can get a better idea of what's happening that way.

- Mark


Astro-Boy!!
http://www.zip.com.au/~astroboy/
Quote Reply
Posted Sub-Routine In reply to
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.
# This is the "short display" -- the list of records that are returned
# from a search.

my (%rec) = @_;
$rec{'ChatInfo'} =~ s/\n/<BR>/g;


($mon, $day, $yr) = split(/\-/, $rec{"Date"});
$yr = substr($yr, 2, 2);
$rec{'Date'} = "$mon-$day-$yr";
$rec{'Celebrity'};
#print qq|
# create link to full display
$record_number = ((($nh - 1) * $db_max_hits) + $i);

$long_url = $ENV{'QUERY_STRING'};
$long_url =~ s/\&nh=\d+//;
$long_url =~ s/\&mh=\d+//;

$long_url = "$db_script_url?$long_url&nh=$record_number&mh=1";

print "<TD>"; # do not remove this! It is necessary to make the records display properly

# Below is where you define what you want to appear for each record in the "short" display.
# You can make this whatever you want, and display as many fields as you would like.
# Choose which of the fields you would like for users to click on to reach the full display
# of records and use that field name in place of "Title" below.
#
# Be sure that you use <a href="$long_url"> for the link to your full record display.

# <-- Start of short display formatting -- >

print qq|
<a href="$long_url">$rec{'Sponsor'}</a>
|;

# if you want to display your fields in columns, use the following format:
# print qq|
# $rec{'Field'}</td>
# <td>$rec{'Field'}</td>
# <td>$rec{'Field'}</td>
# <td>$rec{'Field'}|;

# Add or remove columns as needed. Be sure you add the $long_url link to one of your fields

# <-- End of short display formatting -- >

print "</TD>"; # do not remove this! It is necessary to make the records display properly

}


Quote Reply
Re: Posted Sub-Routine In reply to
Ahh ok, you're using the long/short display MOD.

In that case, you need to add the code to html_record_long.

- Mark


Astro-Boy!!
http://www.zip.com.au/~astroboy/
Quote Reply
Re: Posted Sub-Routine In reply to
Let me just toss this down --- this is what already is in the file...

sub html_record_long {
#----------------------------------------------------------------
my (%rec) = @_;
$rec{$db_key} =~ s/<.?B>//g;

($mon, $day, $yr) = split(/\-/, $rec{"Date"});
$yr = substr($yr, 2, 2);
$rec{'Date'} = "$mon-$day-$yr";

if ($db_total_hits > 1) {

# create links to previous and next records
....
....

shouldnt this work anyway without me having to add that line of info?

Quote Reply
Re: Posted Sub-Routine In reply to
I always add the codes such as:

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

to both the sub html_record and sub html_record_long





Unoffical DBMan FAQ
http://webmagic.hypermart.net/dbman/
Quote Reply
Re: Posted Sub-Routine In reply to
::sigh::

Well - I tried that - and that still didnt work....waaahhhh

I dont understand because I have two other databases where we didnt have to call out the specific field

Quote Reply
Re: Posted Sub-Routine In reply to
Exactly where are you displaying the contents of "ChatInfo", and how?

It depends on how "hacked" your database is, but generally, record info is only displayed in html_record and html_record_long.

You have to "call out the specific field", because - by default - DBMan does not convert form newlines to <BR> tags. So you need to use the code provided to convert newlines appropriately.

In situations like this, it really helps if we can see your html.pl (or whatever) file. Could you post it somewhere on your website where we could check it out? (it's best not to clog up the forum with long code posts).

- Mark


Astro-Boy!!
http://www.zip.com.au/~astroboy/
Quote Reply
Field 7 - UserID In reply to
I did a little research last night --- this new database doesnt have field 7 indicated as URSERID - I thought this was mandatory for the database to work....the other two databases (news and store) have field 7 indicated as userid...but this latest one is the chatinfo field - so my guess is that dbman is getting tripped up?

I have a freelance guy working on this database and am trying to get some answers for him to speed things along as Im hopeless to thgis programming and can just only handle setting up the config file :)

But if someone can certify the Field 7/userid issue as being mandatory - that might just be what the problem is.

Quote Reply
Re: Posted Sub-Routine In reply to
Greetings all!

Ive gone ahead and posted the html_ssi.pl file at:

http://www.digitalworlds.org/dbman/html_ssi.txt

Both my programmer and I are at a loss because he seems to make it work...but when I try to do it - it wont all the line breaks....the only way it seems to work is if it add MANUALLY the command
after each line ... which I dont want to do...

Now, I know I have moved to a new server within my hosting company - but that didnt affect the other databases - so it must be somthing my programmer is missing?


Quote Reply
Re: Posted Sub-Routine In reply to
Reply to:
the only way it seems to work is if it add MANUALLY the command after each line ... which I dont want to do...

Are you meaning that you don't want to have to hit enter as you are entering the data in the field?

I think i'm misunderstanding, but if that is what you meant, it is necessary when you are filling in the field data to use your enter key to note where you want to place a line break. Then the script will know to place the line breaks when you display the record.. but it will not show the <BR> tags.

I noticed when looking at your file that your sub html_record_long is more or less a duplicate of your html_record_form??

This should only be a method of displaying the data entered in your record form and should not also include the input boxes.

It should look something more like this:

<TABLE WIDTH="450" CELLPADDING=0 CELLSPACING=0 BORDER=1>
<TR><TD><$font>ID:</FONT></TD><TD>$rec{'ID'}"></TD></TR>
<TR><TD><$font>Date:</FONT></TD><TD>$rec{'Date'}"></TD></TR>
<TR><TD><$font>Celebrity:</FONT></TD><TD>$rec{'Celebrity'}"></TD></TR>
<TR><TD><$font>Program:</FONT></TD><TD>$rec{'Program'}"></TD></TR>
<TR><TD><$font>Category: </FONT></TD><TD>$rec{'Category'}</TD></TR>
<TR><TD><$font>Sponsor: </FONT></TD><TD>$rec{'Sponsor'}></TD></TR>
<TR><TD><$font>ChatSource: </FONT></TD><TD>$rec{'ChatSource'}></TD></TR>
<TR><TD><$font>ChatInfo:</FONT></TD><TD>$rec{'ChatInfo'}</TD></TR>
<TR><TD><$font>RemoveAd:</FONT></TD><TD>$rec{'RemoveAd'}></TD></TR></TABLE>


Unoffical DBMan FAQ
http://webmagic.hypermart.net/dbman/
Quote Reply
Re: Posted Sub-Routine In reply to
Hi Lois!

For example - I have a news database that all I must do is copy and paste the information. Line breaks are kept "as is" and I do not have to add any "enters" at the end of the lines.

I have tried using the enter key as well and it does not do anything different - it still just flows the information across the screen.

Quote Reply
Re: Posted Sub-Routine In reply to
Doesn't the line break command need to be entered in RECORD_FORM also?
So the DB knows what to do with the line break command (hitting ENTER) in the first place?

I have it in both places in mine. (RECORD_LONG & RECORD_FORM)

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

Also, I think he/she entered the actual HTML tag for a break up there and the script (this one here) is reading the tag and not showing it...
He/She meant to say:
"I have to manually enter the < br > command at the end of each line to get the output formatted correctly."

(You have to put a space after the < so it won't be read as HTML when you post here)

Example
Normal

Line

Breaks

Is now:
Normal< br > Line< br > Breaks< br > (note the spaces)

Hope that actually helps.
(Sure would be cool if I could start giving back to this BBS now)

Joe