how to detect <enter> in textarea??
how to detect or in textarea??
when user press enter, it will brings the user to a new line but when i save into the database, it will save as if it's a new sentence instead of having all the newlines.
what can i do in order to save exactly wat user types in the textarea to the database, so when i retrieve it out, it will be exactly the same as wat user types???
Mark Hensler posted this at 06:37 — 13th January 2003.
He has: 4,048 posts
Joined: Aug 2000
What language are you using? You'll want to search for \n, and replace with .
ASP: Replace(strMyString, vbCrLf, "")
PERL: $string =~ s/\n//g;
PHP: nl2br($my_string)
Mark Hensler
If there is no answer on Google, then there is no question.
joyce posted this at 06:59 — 13th January 2003.
They have: 164 posts
Joined: Nov 2001
actually i plan to use javascript
<script type="text/javascript">
function detectKey() {
if (event.keyCode==13) {alert ("<br>")
}
}
</script>
but instead of alert, i want to insert in the textarea. how am i suppose to do tat??
Suzanne posted this at 15:06 — 13th January 2003.
She has: 5,507 posts
Joined: Feb 2000
replace \r and/or \n and/or a combination of \r and \n with . You should be able to search and replace items in a string even with JavaScript, but it's easier with Server Side scripting.
joyce posted this at 00:26 — 14th January 2003.
They have: 164 posts
Joined: Nov 2001
how to replace using javascript?
Suzanne posted this at 00:46 — 14th January 2003.
She has: 5,507 posts
Joined: Feb 2000
You would search and replace the bad characters in the string on the way into the database -- which brings us back to Mark's question: what language are you using to talk to your database?
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.