Link to home
Start Free TrialLog in
Avatar of onebite2
onebite2

asked on

HTML - Text area

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

Avatar of Paul Jackson
Paul Jackson
Flag of United Kingdom of Great Britain and Northern Ireland image

Set the wrap attribute to hard on the textarea :
<textarea cols="20" rows="5" wrap="hard">
ASKER CERTIFIED SOLUTION
Avatar of HainKurt
HainKurt
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of onebite2
onebite2

ASKER

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
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
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 :)
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.
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...
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.
 
please post the rendered html, so we can see on our browsers...
Let me know if you need anything
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>
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...
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
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
Found the issue.