Retain Whitespaces

R

rn5a

When a Button is clicked in a Form, the JavaScript 'prompt' dialog
pops-up for users to enter any text. When the user clicks OK in the
prompt dialog, the text is populated in a TextBox & the Form posts. I
then retrieve the text using Request.Form.

The problem I am facing is in retaining whitespaces in the text the
user has entered. Assume that the user has entered the following text
in the JavaScript prompt dialog (note the whitespaces in the string):

"abc def ghi jkl"

The double quotes have been added just to show where the string ends;
they aren't a part of the string.

Now when I retrieve the string using Request.Form, this is what I get
(once again please neglect the double quotes):

"abc def ghi jkl"

i.e. irrespective of the number of whitespaces a user has inserted in
between the words in the JavaScript prompt dialog, Request.Form always
replaces all the whitespaces in between the various words in the string
with a single whitespace.

How do I ensure that the whitespaces inserted by the user in the
JavaScript prompt dialog are retained by Request.Form?
 
T

TiSch

When a Button is clicked in a Form, the JavaScript 'prompt' dialog
pops-up for users to enter any text. When the user clicks OK in the
prompt dialog, the text is populated in a TextBox & the Form posts. I
then retrieve the text using Request.Form.

The problem I am facing is in retaining whitespaces in the text the
user has entered. Assume that the user has entered the following text
in the JavaScript prompt dialog (note the whitespaces in the string):

"abc def ghi jkl"

The double quotes have been added just to show where the string ends;
they aren't a part of the string.

Now when I retrieve the string using Request.Form, this is what I get
(once again please neglect the double quotes):

"abc def ghi jkl"

i.e. irrespective of the number of whitespaces a user has inserted in
between the words in the JavaScript prompt dialog, Request.Form always
replaces all the whitespaces in between the various words in the string
with a single whitespace.

How do I ensure that the whitespaces inserted by the user in the
JavaScript prompt dialog are retained by Request.Form?

Hello,

i dont know where the problem is because the textbox retains its value
WITH whitespaces.

regards,
Tim
 
R

rn5a

Actually the text that will be entered by the user in the JavaScript
prompt dialog, a directory will be created on the server whose name
will be the same as the text in the prompt dialog. What I find is
though Request.Form doesn't retain the whitespaces entered by the user
in the prompt dialog, the new directory name retains the whitespaces.

So if the text entered by a user is

"abc def ghi jkl"

then though Request.Form produces

"abc def ghi jkl"

the name of the new directory that gets created gets set to

"abc def ghi jkl"

(of course, without the double quotes).

So as such, no problem for the time being.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top