hi all!
for example;[enter] represents pressing enter key.
i am typing "nirmal [enter] singh [enter] B"
in a text area, so the result in textarea will be in three lines as follows.
nirmal
singh
B
while i get this data from textarea and save in database, i want to save something representing like enter key pressed or new line along with text. so that i can retrieve the record from database and show it in a same format as
nirmal
singh
B
how can i do this?
thanx in advance.
8 2874
hi all!
for example;[enter] represents pressing enter key.
i am typing "nirmal [enter] singh [enter] B"
in a text area, so the result in textarea will be in three lines as follows.
nirmal
singh
B
while i get this data from textarea and save in database, i want to save something representing like enter key pressed or new line along with text. so that i can retrieve the record from database and show it in a same format as
nirmal
singh
B
how can i do this?
thanx in advance.
Now what's getting stored in DataBase?
Debasis Jana
Now what's getting stored in DataBase?
Debasis Jana
while passing the value in query string using ajax to save it, the enter character is ignored and saved as a sequence sentence.
gits 5,390
Expert Mod 4TB
hi ...
you may use a regEx to prepare the value ... have a look at the following example: - <html>
-
<head>
-
<script type="text/javascript">
-
-
function prepare_value() {
-
var value = document.getElementById('text').value;
-
-
value = value.replace(/(\n|\r\n)/g, '\n');
-
-
alert(value);
-
}
-
-
</script>
-
</head>
-
<body>
-
<form name="myform">
-
<textarea id="text"></textarea>
-
<input type="button" value="prepare" onclick="prepare_value();">
-
</form>
-
</body>
-
</html>
-
kind regards
hi ...
you may use a regEx to prepare the value ... have a look at the following example: - <html>
-
<head>
-
<script type="text/javascript">
-
-
function prepare_value() {
-
var value = document.getElementById('text').value;
-
-
value = value.replace(/(\n|\r\n)/g, '\n');
-
-
alert(value);
-
}
-
-
</script>
-
</head>
-
<body>
-
<form name="myform">
-
<textarea id="text"></textarea>
-
<input type="button" value="prepare" onclick="prepare_value();">
-
</form>
-
</body>
-
</html>
-
kind regards
yah it is working well as i wished format, but when i transfer that data to another page via querystring, all the datas are concatenated as nirmalsinghb
what to do to solve this?
yah it is working well as i wished format, but when i transfer that data to another page via querystring, all the datas are concatenated as nirmalsinghb
what to do to solve this?
You can use a special character and then replace it using your server side script.
Mind it your special character should never occur in your Query String.
Debasis Jana
You can use a special character and then replace it using your server side script.
Mind it your special character should never occur in your Query String.
Debasis Jana
thank u jana i already tried it.
but i replaced the character,'/n' by '~' but it is not replaced.
thank u jana i already tried it.
but i replaced the character,'/n' by '~' but it is not replaced.
-
var value = document.getElementById('text').value;
-
value = value.replace(/(\n|\r\n)/g, '~');
-
//now here prepare the query string ...............
-
Debasis Jana
-
var value = document.getElementById('text').value;
-
value = value.replace(/(\n|\r\n)/g, '~');
-
//now here prepare the query string ...............
-
Debasis Jana
thanx jana, its working perfectly.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Amin Gunawan via .NET 247 |
last post by:
I would like to put a combo box in a column of a datagrid.
I've seen the samples in the MSDN library of other sources, butall samples didn't catch the 'DOWN/UP' keystroke. It means thatwhen I select...
|
by: Frank Bormann |
last post by:
Hi,
probably a stupid question, but I haven't been able to find anything.
Is there a istream related function that let me read exactly one keystroke
from the keyboard through cin?
What I...
|
by: GG |
last post by:
I have a console app that when it is run and I press a key
then it freezes till a press another key gain.
Is there a way to avoid it that is the keystrokes do not pause the app?
Thanks
...
|
by: Brian Schwartz |
last post by:
I'm writing a console application. Both Read and ReadLine wait for enter to
be pressed before returning. Isn't there a way to read a single character
and continue immediately, without waiting for...
|
by: Adam J. Schaff |
last post by:
I have noticed that if a user closes a form via pressing return (either
while the OK button has focus or if AcceptButton is set to OK for the form)
then the "ENTER" keypress event fires ON THE...
|
by: tekhneek |
last post by:
is there ANYWAY to have a variable monitor keystrokes on an active page
with javascript and if x keys are pressed, show an alert? in other
words If I'm on the site and I type in "login", it alerts...
|
by: Amali |
last post by:
I'm newdie in c programming. this is my first project in programming.
I have to write a program for a airline reservation. this is what i
have done yet. but when it runs it shows the number of...
|
by: gsxg |
last post by:
I am new to python, and have written a simple program to read a port
via telnet. I would like it to run until any key is pressed. Of
course I wouldn't mind requiring a specific keystroke in the...
|
by: visweswaran2830 |
last post by:
Hi,
I need to stop the keystroke event when I pressed a particular key.
For Eg:
If press alt+tab key then that keys should not perform that operation, that should operation should be...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
| |