Solved

carriage return in popup window is gone

Posted on 2001-09-11
7
439 Views
Last Modified: 2008-03-03
I use JS popup window in cold fusion page.
when i click the text link, the notes shown up in popup window, all the carriage returns are gone.
when i use
"select notes from stunotes"
in SQL query analyzer, the carriage returns are there.

Any idea is highly appreciated. Thanks.

WJ53
0
Comment
Question by:wj53
  • 4
  • 2
7 Comments
 
LVL 1

Accepted Solution

by:
FranzRinkleff earned 60 total points
Comment Utility
not sure if i fully understand your problem.

but this it what is sounds like to me.  

you have a cold fusion page.
you have a query and the results of the query is text with carriage returns
it has a link that when clicked a javascript function opens a new window.  
the new window displays the results of your query.  however, the carriage returns are not being shown in the new window.  

The reason you do not see the carriage returns in the new window is because blank spaces are not recognized in html.
the following would look the same <h3>Hello World</h3> and
<h3>Hello        World</h3>  Cut and paste them to see.  Carriage returns are also not recognized by HTML.


So you have to choices.  

You could use the Replace function in SQL to replace all of your carriage returns with <BR>.  The <BR> html element would then cause new lines to appear.

Or you could create an html <textarea> like this
<textarea name="textBoxDesc#eventCounter#" rows="5" cols="100">#textbox_desc#</textarea>

where #textbox_desc# is the result of your query.  since the result of the query is part of the textarea the carriage returns will be shown.  

0
 

Author Comment

by:wj53
Comment Utility
Hi FranzRinkleff ,
you understand it correctly. That's exactly what the problem is.
I will try the <textarea> first. if I draw the textarea the same size as the window, it seems like it should fit the window.
Thanks,
WJ53
0
 

Author Comment

by:wj53
Comment Utility
in the textarea the carriage return is taken care of automaticlly. But after i add the textarea in "popnote.cfm", it looks not pretty at all. Outer layer is popup window, inside is iframe, inside is textarea. I know little knowledge about JS. do you how to get rid of iframe and only leave textarea in the window? Thanks.

//notelist.cfm
<script>
function showPopupWindow(url, top, left, width, height) {
....

newwin.document.write('<iframe width='+(width-10) +' height='+(height-50)+' src='+url+'></iframe>')
newwin.document.write('<br><center><a href="#" onClick ="window.close();return false;">')
newwin.document.write('<img src="images/close.gif" border="0"></a></center>')
...
</script>

<html>
<body>
<a href="http://www.mysite.com/popnote.cfm?notekey=#notekey#"
onClick="JavaScript:showPopupWindow(this.href,100,100,500,600); return false">#Trim(smallnote)#&nbsp;</a>
</body>
</html>

//popnote.cfm
<html>
<body>
<body>
<cfquery>...
</cfquery>
<cfoutput query="FULLNOTE">
<textarea name="textBoxDesc" rows="25" cols="38">#note#</textarea>

</cfoutput>
</body>
</html>

wj53

0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:wj53
Comment Utility
I find out if i use textarea in the popup window, it's a temptation to add something or modifiy it there. Eventhough any modification is discarded, i think i have to SQl solution.

the note is saved as text data type. how to add chr(13) for each carriage return?
0
 

Author Comment

by:wj53
Comment Utility
I went to SQL forum and found answer to replace this trick text date type with <BR>.
If anyone is interested in the answer, pls go
http://www.experts-exchange.com/jsp/qManageQuestion.jsp?ta=mssql&qid=20182000

FranzRinkleff, i will pass my points to you in a few days. Just don't like to see my points decrease too much in a day. :-)

0
 
LVL 1

Expert Comment

by:Moondancer
Comment Utility
On 9/21/01 you said that you would pass ponts to FranzRinkleff in a few days, but have not done so yet.  Please do, accept his comments and convert it to the Accepted Answer to then grade and close this (A grade, I hope.  Anytime you choose to grade with less than an A grade, it is important to tell the experts why.  They take great pride in providing excellent support).

Moondancer
Community Support Moderator @ Experts Exchange
0
 
LVL 1

Expert Comment

by:Moondancer
Comment Utility
Thanks.
Moondancer
Community Support Moderator @ Experts Exchange
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

When you need to keep track of a simple list of numbers or strings, the Array object is your most direct tool.  As we saw in my earlier EE Article (http://www.experts-exchange.com/A_3488.html), typical array handling might look like this: (CODE) B…
The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now