Retain Whitespaces

Discussion in 'ASP General' started by rn5a@rediffmail.com, Jan 6, 2007.

  1. Guest

    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?
    , Jan 6, 2007
    #1
    1. Advertising

  2. Gazing into my crystal ball I observed writing in
    news::

    > 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-space:pre"
    [http://www.w3.org/TR/REC-CSS2/text.html#propdef-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
    Adrienne Boswell, Jan 6, 2007
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Joona I Palaste
    Replies:
    1
    Views:
    484
    Berco
    Jan 7, 2004
  2. Berco
    Replies:
    0
    Views:
    1,686
    Berco
    Jan 7, 2004
  3. Kimos
    Replies:
    0
    Views:
    591
    Kimos
    Apr 14, 2004
  4. Prawdziwa Blondynka
    Replies:
    0
    Views:
    523
    Prawdziwa Blondynka
    Mar 7, 2005
  5. Retain Whitespaces

    , Jan 6, 2007, in forum: ASP .Net
    Replies:
    2
    Views:
    363
Loading...

Share This Page