| Author |
input double quotes in input field
|
lily zou
Ranch Hand
Joined: Jan 15, 2002
Posts: 50
|
|
I have a simple question. How to input a string surrended by double quotes in web page. it seems that all the string incluing leading double quotes will be truncated. Thanks, Lily
|
 |
Satish Gopalakrishnan
Ranch Hand
Joined: Feb 13, 2001
Posts: 52
|
|
|
If your looking to pass values with double quotes , posting the form must achieve it. If you are looking for an escape sequence, the there is an escape() method in javascript i think which will achieve that
|
 |
Eric Pascarello
author
Rancher
Joined: Nov 08, 2001
Posts: 15003
|
|
Not sure what you are asking,,,, say you have this line: string="THis has more quotes " " in it"; And that results in an error You can do it by escapeimg the center quotes, " or the easier ways string="THis has more quotes \" \" in it"; OR string='THis has more quotes " " in it'; Is that what you are asking?
|
 |
Bear Bibeault
Author and opinionated walrus
Marshal
Joined: Jan 10, 2002
Posts: 50674
|
|
The escape() method is not used to escape quotes in strings. This method (deprecated in modern browsers) is used to perform URL-encoding. This is most useful when building up a URL on the client side that has a query string of request parameters. (Note: when submitting via a form, no URL-encoding is necessary; the form submission handles it all behind the scenes). Just to clarify, bear
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
lily zou
Ranch Hand
Joined: Jan 15, 2002
Posts: 50
|
|
Thanks for all your reply. What I want to do is that : I have a input field there and I want to save a string which is surrounded by " and ". I tried escape sequence but useless. The browser always trancats the part after the first leading double quotes. For example, if I entered kkk"abc"kkk ( Note: including double quotes ) into that input field, then press save button, the value now in the input field is kkk only. Enter kkk\"abc\"kkk is the same. It returns me kkk\. I use IE browser. Thanks again, Lily
|
 |
Eric Pascarello
author
Rancher
Joined: Nov 08, 2001
Posts: 15003
|
|
|
Sounds like it is your server side code that you are saving it too?!?
|
 |
Bear Bibeault
Author and opinionated walrus
Marshal
Joined: Jan 10, 2002
Posts: 50674
|
|
Ah! So what you are saying is that you are manually typing a value into a form field from the keyboard that contains a quote character, and that the submitted value is being truncated at the quote? If so, that should not happen. The default encoding of the form data should handle all the appropriate URL encoding. You don't have any funky enctype attribute on your form tag, do you? In any case, why not post the HTML code you are using to render the form and input field (PLEASE be sure to use the UBB code tags so that the formatting is preserved), as well as the code you are using for processing the form value on the server side (where it is I am assuming that you are seeing the truncated value). hth, bear
|
 |
Amy Phillips
Ranch Hand
Joined: Apr 02, 2003
Posts: 280
|
|
Hi, you don't really say what you are using to process this form. However I do know that you get around this problem in asp by using the replace statement to replace all single ' with doubles. Maybe look into this and see if it helps you.
|
 |
 |
|
|
subject: input double quotes in input field
|
|
|