473,396 Members | 2,002 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

how to get rid of the new line blanks in textarea?

<%Function ListCPN()%>

<!--<textarea class="project" name="txtCPN"></textarea>-->

<TEXTAREA class="project" name="txtCPN" cols="35" rows="10"></TEXTAREA>


<%End Function%>
Jun 28 '07 #1
7 5557
jhardman
3,406 Expert 2GB
karen,

this shouldn't give you any blank lines. It didn't when I tried it just now.

Jared
Jun 28 '07 #2
karen,

this shouldn't give you any blank lines. It didn't when I tried it just now.

Jared
Hi Jared,

Thanks. I would like to trim off if there is enter blank in text area so that no empty fields are shown in the table of the following page.

Users can only enter CPN line by line but cannot press enter key for new line.
Jun 29 '07 #3
jhardman
3,406 Expert 2GB
Oh, I think I understand. So a user theoretically might enter a blank line which you don't want. Well, if you want to handle this with asp you could say:
Expand|Select|Wrap|Line Numbers
  1. dim lines, x, outputText
  2. lines = split(request("myTextBox"), vbNewLine)
  3. for each x in lines
  4.    if trim(lines(x)) <> "" then
  5.       outputText = outputText & lines(x) & vbNewLine
  6.    end if
  7. next
and you are left with outputText which includes all of the original request.form("myTextBox") minus any blank lines.

Does that work for you?

Jared
Jun 29 '07 #4
Oh, I think I understand. So a user theoretically might enter a blank line which you don't want. Well, if you want to handle this with asp you could say:
Expand|Select|Wrap|Line Numbers
  1. dim lines, x, outputText
  2. lines = split(request("myTextBox"), vbNewLine)
  3. for each x in lines
  4.    if trim(lines(x)) <> "" then
  5.       outputText = outputText & lines(x) & vbNewLine
  6.    end if
  7. next
and you are left with outputText which includes all of the original request.form("myTextBox") minus any blank lines.

Does that work for you?

Jared


Thanks. no syntax error but it doesn't work. The empty fields still showed in the tables of following page.

Why?
Expand|Select|Wrap|Line Numbers
  1. <%Function ListCPN()%>
  2.  
  3.  
  4. <TEXTAREA class="project" name="txtCPN" cols="35" rows="10"><%Call trimLines%></TEXTAREA>
  5.  
  6.  
  7. <%End Function%>
  8.  
  9.  
  10. <%
  11. Function trimLines
  12.  
  13. dim lines, x, outputText
  14. lines = split(request("txtCPN"), vbNewLine)
  15. for each x in lines
  16.    if trim(lines(x)) <> "" then
  17.       outputText = outputText & lines(x) & vbNewLine
  18.    end if
  19. next
  20.  
  21. End Function
  22.  
  23. %>
Jun 29 '07 #5
jhardman
3,406 Expert 2GB
This is the code for the page where the user enters the info? It won't work there. Remember that ASP code only works WHILE the server is sending the page to the user. I had intended this code to be the code on the following page. and I think I got part of the code wrong anyway. I just tried this to make sure. the entire form was saved as "texttest.asp". The form submits to the same page, and everytime all of the blank lines are taken out and the text (minus any blank lines) is put in the textarea.
Expand|Select|Wrap|Line Numbers
  1. <%
  2. dim lines, x, outputText
  3. lines = split(request("myText"), vbNewLine)
  4. for each x in lines
  5.    if trim(x) <> "" then
  6.       outputText = outputText & x & vbNewLine
  7.    end if
  8. next %>
  9. <form action="texttest.asp" method="post">
  10. <textarea name="myText"><%=outputText%></textarea>
  11. <input type="submit" name="submit" value="submit">
  12. </form>
Jun 29 '07 #6
The enter blanks cannot be cut off and the blanks still showed in the table of following page.
I need to use Next pagelink instead of submit input.
The bold link is the link to the following page.


Dim rsEmail, qryEmail
Dim res
Dim strInput, Count

Dim lines, x, outputText
lines = split(request("txtCPN"), vbNewLine)
for each x in lines
if trim(x) <> "" then
outputText = outputText & x & vbNewLine
end if
next

<form name="frmInput" action="ApprovePartsDisplay.asp" method="post">

<tr class="filter">
<td width="120"></td>
<td></td>
<td><a onclick="javascript:document.frmInput.submit()"><f ont class="pageLink">&gt&gt Next</font></a></td>
</tr>

<%Function ListCPN()%>


<TEXTAREA class="project" name="txtCPN" cols="35" rows="10"><%=outputText%></TEXTAREA>


<%End Function%>
Jul 2 '07 #7
jhardman
3,406 Expert 2GB
Karen,

I am no longer following what you are saying. What is generating the content of the textarea? If you are generating the textarea, then just don't put in blank lines. If the user is filling it out, then remove the blank lines before you save it. I don't understand which part is giving you trouble.

Jared
Jul 3 '07 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: entoone | last post by:
I have a form that has a text box, i.e. text area that takes 200 characters max. When I use my update script and it brings up the information in the database, it displays as a single line. How can...
12
by: dan glenn | last post by:
Hi. I'm finding that if I have text entered into a <textarea ...> </textarea> in a form, and that text has leading blank lines (with no spaces or anything else), that when I retrieve the entered...
6
by: Jonathan | last post by:
I want to save textarea contents to a mysql database with the paragraph breaks intact without having to type paragraph or break tags in HTML. How can I do that. So far, although it occurs naturally...
11
by: Johnny Two Dogs | last post by:
I'm strictly concerned with IE, so cross-browser compatibilty isn't necessary. If you view the code below, I almost get exactly what I'm looking for: - A table of four cells that...
5
by: joelbyrd | last post by:
Didn't know exactly where to post this, but: How do I get line breaks in a textarea? I'm pulling text from a database, and this text definately has line breaks in it, because I replaced all the...
2
by: Mike Brophy | last post by:
Here's my problem: I need to present text in a scrolling textarea such that a checkbox is not enabled until the user has scrolled to the very last line of the text using the vertical scrollbar. ...
14
by: ghostwalker | last post by:
Hi I have an HTML form with a textarea on it. When submitted (using 'get' not 'post') this forms action php file simply does this to retrieve the values: $message = $_GET; Now it all works...
15
by: Spiros Bousbouras | last post by:
I'm thinking of adding a command to vim for removing white space from the end of each line of a C source file. Can anyone think of a situation where such white space might be useful ?
4
by: lilyumestar | last post by:
I have project I have to do for class. We have to write 4 different .java files. Project2.java HouseGUI.java House.java HouseSorting.java I already finish House.java and I need to work on...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.