We help IT Professionals succeed at work.

HTML - Text area

onebite2
onebite2 asked
on
Medium Priority
320 Views
Last Modified: 2012-05-11
Have an issue with posting/preview posting threads.
Users would enter data in any format in the thread and we were suppose to retrieve the data in the same way, something similar to here.. the way i'm typing.

If users adds line breaks or carriage returns then does the post, i'm able to handle that and show the same way but if user has entered continuously without a break something like below..  i'm not able to break the way text area does it.

--See alphabets along with numbers part break up meaning i'm able to show them the way user entered the data but those below numbers entered continuously i can't break that up the same way..
abcde 11111 abcde 22222 abcde 33333 abcde 44444 abcde 55555
abcde 11111 abcde 22222 abcde 33333 abcde 44444 abcde 55555
abcde 11111 abcde 22222 abcde 33333 abcde 44444 abcde 55555
abcde 11111 abcde 22222 abcde 33333 abcde 44444 abcde 55555
abcde 11111 abcde 22222 abcde 33333 abcde 44444 abcde 55555
abcde 11111 abcde 22222 abcde 33333 abcde 44444 abcde 55555
abcde 11111 abcde 22222 abcde 33333 abcde 44444 abcde 55555

--see below how the text area breaks it up
-- i can't do the same when i post or preview
this happens because its a text area but i cant seem to do it on the page.
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111122222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222223333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333
Let me know how would i do break it on page on when i post and retrieve the text back to page. Remember something users can put carriage returns or breaks at the end.. so i have this code attached for that but code doesn't work continuous data entry process.
Let me know if you have questions.

Thanks!
Function LineBreak(strDisplay)
    strDisplay = Replace (strDisplay, "<br />", vbcrlf)
    LineBreak = strDisplay
End Function
<!--would call this function on the display in <td tag> -->
.Write "<td class='background'><small>" & LineBreak(strPostDescription) & "</small><br />"
<!--but this doesn't work for continuous data entry.-->

Open in new window

Comment
Watch Question

Paul JacksonSoftware Engineer
CERTIFIED EXPERT
Top Expert 2011

Commented:
Set the wrap attribute to hard on the textarea :
<textarea cols="20" rows="5" wrap="hard">
Sr. System Analyst
CERTIFIED EXPERT
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
HainKurt, It adds dash at the end. Any idea
It does break it fine but adds dashes at the end. I'm sure its not from my code.
abcde 11111 abcde 22222 abcde 33333 abcde 44444 abcde 55555
abcde 11111 abcde 22222 abcde 33333 abcde 44444 abcde 55555
abcde 11111 abcde 22222 abcde 33333 abcde 44444 abcde 55555
abcde 11111 abcde 22222 abcde 33333 abcde 44444 abcde 55555
abcde 11111 abcde 22222 abcde 33333 abcde 44444 abcde 55555
abcde 11111 abcde 22222 abcde 33333 abcde 44444 abcde 55555
abcde 11111 abcde 22222 abcde 33333 abcde 44444 abcde 55555

--It does break it fine but adds dashes at the end. I'm sure its not from my code.
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 - 0111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 - 1222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222 - 2333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 - 3

Any thoughts

Author

Commented:
Looks like browser does it but not sure.. It's def. not in my code.
When user enters flowing text on text area, save and retrieve the data shows soft hyphen or "-" at the end of flowing text.
Just like this
000000000000000000000000000000000000000000000000000000000000000000000000000001111111111111111111111111111111111111111111111111111111111111111111111111111111111111 - 233333333333333333333333333333333332222222222222222 - 2333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 - 3

But when i post the data, there isn't any dashes or hyphens, i even looked at the database.
000000000000000000000000000000000000000000000000000000000000000000000000000001111111111111111111111111111111111111111111111111111111111111111111111111111111111111333333333333333333333333333333333322222222222222223333333333333333333333333333333333333333333333333333333333333333333333333333

Any thoughts
HainKurtSr. System Analyst
CERTIFIED EXPERT

Commented:
use this

<textarea style="scroll:auto;width:600px;border:1px solid gray;" rows=7 readonly>
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111122222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222223333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333
</textarea>

if you need add more style to make it like a div :)

Author

Commented:
I would give it try but i don't think it has to do anything with text area.
After the post the message, we display the message on screen on browser i mean.
Message is been displayed on browser page.
That's the i said browser doing this maybe.
HainKurtSr. System Analyst
CERTIFIED EXPERT

Commented:
whats your latest code that gives - ? also did you check the source of the page on browser? right click, view source... what do you see there, copy and paste here...

Author

Commented:
It still shows hyphen at the end of the line.
Again looks like hyphens are being forced by browser to break continuous flowing text .
Not sure why this is happening and how to prevent hyphens at the end.
 
HainKurtSr. System Analyst
CERTIFIED EXPERT

Commented:
please post the rendered html, so we can see on our browsers...

Author

Commented:
Let me know if you need anything
HainKurtSr. System Analyst
CERTIFIED EXPERT

Commented:
if this is the case, some code is adding those -

nothing to do with browsers... what is your code (that produces this, not the first post, the one you are using right now) to create this? I mean this part

<td class='background'><small>....</small><br /></td>
HainKurtSr. System Analyst
CERTIFIED EXPERT

Commented:
in your very first post, you said you are using this:

.Write "<td class='background'><small>" & LineBreak(strPostDescription) & "</small><br />"

this does not produce the html you posted if you already checked the db and there is no - inside...
The function is not responsible for this... then how do you get data from your db and put into strPostDescription? you never mentioned this and the problem is there I guess... post the code for getting data from db, and storing it into strPostDescription and all steps if you do with strPostDescription...

Author

Commented:
There are no hyphens or dashes if i use this
.Write "<td class='background'><small>" & strPostDescription & "MR" & "</small><br />"

but when i use the function and do below, i find hyphens or dashes
.Write "<td class='background'><small>" & LineBreak(strPostDescription) & "</small><br />"

Here is the function
Function LineBreak(strDisplay)
    strDisplay = Replace (strDisplay, vbcrlf, "<br />")
    LineBreak = strDisplay
End Function

Author

Commented:
There are no hyphens or dashes if i use this
.Write "<td class='background'><small>" & strPostDescription & "</small><br />"

but when i use the function and do below, i find hyphens or dashes
.Write "<td class='background'><small>" & LineBreak(strPostDescription) & "</small><br />"

Here is the function
Function LineBreak(strDisplay)
    strDisplay = Replace (strDisplay, vbcrlf, "<br />")
    LineBreak = strDisplay
End Function

Author

Commented:
Found the issue.
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.