Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Formatting textbox data retrieved using Request.Form method in ASP

Status
Not open for further replies.

ggs54

Programmer
Apr 7, 2003
8
US
I have a textbox on an ASP page, which is filled by a series of user queries. Once my customer is ready, he can display all of the query results in a single scrolling textbox. He can also edit the results of that textbox. The data layout within the textbox is in table form and Courier New is the fixed-space font. For example:
Qty Product Code Botanic Name Size Price North South
--- -------------- ------------------------------ ------ ------- ----- -----
1 PIPUMON3C PICEA PUNGENS 'MONTGOMERY' #3 60.00 7

1 ARARBRI5C ARONIA ARB 'BRILLIANTISSIMA' #5 11.25 17 16

Note the spaces in the title line between Botanic Name and Size.

When the user submits the information, I'm retrieving the data on a new ASP page using the Request.Form method. This works perfectly for all of the other data on the form, check boxes, single-line text boxes, etc. However, it strips all of the spaces from the scrolling textbox and looks like this:

Qty Product Code Botanic Name Size Price North South --- -------------- ------------------------------ ------ ------- ----- ----- 1 PIPUMON3C PICEA PUNGENS 'MONTGOMERY' #3 60.00 7 1 ARARBRI5C ARONIA ARB 'BRILLIANTISSIMA' #5 11.25 17 16

What I am trying to do is to create a confirmation page for my customer, that can also be printed out for their records. I then intend to have the same ASP page send this data via e-mail to my order processors. Both of these items need to have the information appear the same as it does on the submission page.

Thanks in advance for your help.

ggs54
 
the textbox is set for 80 columns. i do have the textbox within a cell and Wrap can be set either way with the same results.

 
I am trying to figure this out. Can't you just put another textarea with the same dimensions and make it readonly for the user to see it? If anyone else has an idea please help I would love to here how to do this.
 
I tried adding a scrolling textbox to my confimation page. The data is still 'stripped' when it loads into this new textbox. The solution, I think, has to do with passing the original data to the server.
 
I did it and it looked nice. Sorry I did not have a better answer
 
Thanks to everyone who responded. Here's the solution. Substitute the HTML equivalent for both a space and carriage return.

Here's what the original and final code looks like, should someone in the future have the same problem:

Original
<tr>
<td width=&quot;100%&quot;><font face=&quot;Courier New&quot; size=&quot;2&quot;><%=Request(&quot;Comments&quot;)%></font></td>
</tr>
<tr>

Final
<%
Dim HTML_Comments
HTML_Comments=Request(&quot;Comments&quot;)
HTML_Comments=Replace(HTML_Comments,&quot; &quot;,&quot;&nbsp;&quot;)
HTML_Comments=Replace(HTML_Comments, chr(13),&quot;<BR>&quot;)
%>

<td width=&quot;100%&quot;><font face=&quot;Courier New&quot; size=&quot;2&quot;><%=HTML_Comments%></font></td>
</tr>
 
I had the same issue. I have tryied your suggestion but now I get nothing displayed.

Here's my code:

<table border=&quot;0&quot;>
<%
Do While Not rstSearch.EOF

HTML_Comments=Request(&quot;Field2&quot;)
HTML_Comments=Replace(HTML_Comments,&quot; &quot;,&quot; &quot;)
%>
<tr>
<td><%= HTML_Comments%></td>
</tr>
<%
rstSearch.MoveNext
Loop

Any suggestions. I moved the DIM statement to the top. It doesn't work either way.
 
Tried this too. Same result.

<td><%= Replace(rstSearch.Fields(&quot;Field2&quot;).Value,&quot; &quot;,&quot; &quot;)%></td>

Any help would be greatly appreciated.
 
You can't see the important part because the page is resolving it to a space, but what he is actually doing here is replacing a space with an &amp;nbsp;
Code:
<td><%= Replace(rstSearch.Fields(&quot;Field2&quot;).Value,&quot; &quot;,&quot;&amp;nbsp;&quot;)%></td>

Give that a shot, it should fix it for you.

[sub]01010100 01101001 01100101 01110010 01101110 01101111 01101011 00101110 01100011 01101111 01101101 [/sub]
[sup]29 3K 10 3D 3L 3J 3K 10 32 35 10 3E 39 33 35 10 3K 3F 10 38 31 3M 35 10 36 3I 35 35 10 3K 39 3D 35 10 1Q 19[/sup]
Get better results for your questions: faq333-2924
Frequently Asked ASP Questions: faq333-3048
 
Perfect. Thanks alot.
One more thing. I have an empty record, no spaces or any other chars, I get &quot;Invalid use of Null: 'Replace'&quot; on the above line. Should I also replace NULLs with <br>?
Thanks again for your help.
 
No, the Replace function can't act on an empty string, so you need to make sure it has content before doing a Replace on it. Basically that would consist of doing an if check either against the length or it's equality to an empty string: &quot;&quot;

-Tarwn

[sub]01010100 01101001 01100101 01110010 01101110 01101111 01101011 00101110 01100011 01101111 01101101 [/sub]
[sup]29 3K 10 3D 3L 3J 3K 10 32 35 10 3E 39 33 35 10 3K 3F 10 38 31 3M 35 10 36 3I 35 35 10 3K 39 3D 35 10 1Q 19[/sup]
Get better results for your questions: faq333-2924
Frequently Asked ASP Questions: faq333-3048
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top