Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Retain Whitespaces

Reply
Thread Tools

Retain Whitespaces

 
 
rn5a@rediffmail.com
Guest
Posts: n/a
 
      01-06-2007
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 entered by the user in the
JavaScript prompt dialog are retained by ASP?

 
Reply With Quote
 
 
 
 
Adrienne Boswell
Guest
Posts: n/a
 
      01-06-2007
Gazing into my crystal ball I observed http://www.velocityreviews.com/forums/(E-Mail Removed) writing in
news:(E-Mail Removed) ups.com:

> 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 entered by the user in the
> JavaScript prompt dialog are retained by ASP?
>
>


Possibly having something to do with the fact that HTML collapses white
space. You could _try_ using style="white-spacere"
[http://www.w3.org/TR/REC-CSS2/text.h...f-white-space] in the
input element to retain it.


--
Adrienne Boswell at Home
Arbpen Web Site Design Services
http://www.cavalcade-of-coding.info
Please respond to the group so others can share

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Retain Whitespaces rn5a@rediffmail.com ASP .Net 2 01-06-2007 09:36 PM
Setting a schema path that contains whitespaces (Xerces) Prawdziwa Blondynka XML 0 03-07-2005 06:56 PM
Preserving whitespaces in dom4j. Kimos Java 0 04-14-2004 01:53 AM
Re: XML: How to remove whitespaces from element's text? Joona I Palaste Java 1 01-07-2004 06:44 PM
XML: How to remove whitespaces from element's text? Berco Java 0 01-07-2004 06:31 PM



Advertisments