double quote question..

Results 1 to 2 of 2

Thread: double quote question..

  1. #1
    Join Date
    Dec 1969

    Default double quote question..

    Hey all... I have a pretty easy question and Im sure it is somewhere in the searchable archive (but I have yet to find it). Basicly I have a input field where the user can type in text... if there is an error when the form is processed they are returned to the same page and the input field should retain its value. The problem occurs when the user inputs a " in the text box. <BR><BR>Here is a quick example.<BR>Say I have a single input field on a form in which a user needs to enter a email address. The user enters fdsf" as the value. This does not pass the validation rules and they are returned to the same page. I populate the input field with the previous value like so: &#060;input type="input" name="email" value"&#060;%= Request("email") %&#062;"&#062;<BR><BR>Problem occurs when I fill in the value of Request("email") which makes the html look like:<BR>&#060;input type="input" name="email" value"fdsf""&#062;<BR><BR>That extra double quote messes everything up.<BR><BR>how do i avoid this..<BR>thanks<BR>john

  2. #2
    Join Date
    Dec 1969

    Default RE: double quote question..

    First of all, you missed the = after VALUE. <BR><BR>&#060;input type="input" name="email" value"&#060;%= Request("email") %&#062;"&#062;<BR><BR>See it?<BR><BR>Anyway, to fix this, you can REPLACE the " inside the field with &amp;QUOT; -- thus:<BR><BR>&#060;input type="input" name="email" <BR>&nbsp; &nbsp; value="&#060;%= Replace(Request("email"),Chr(34),"&amp;QUOT;") %&#062;"&#062;<BR><BR>The Chr(34) is one way of getting a " mark as a single character in VBS.<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts