Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

<input box>

Status
Not open for further replies.

durug

Technical User
Mar 22, 2002
335
CA
Hi everybody!
I have this line in my asp page:

<input name=Comment type=text value='<%Response.write trim(rsInfo(&quot;Comment&quot;))%>'>

where rsInfo(&quot;Comment&quot;) = value from the database

My problem is that when the value of rsInfo(&quot;Comment&quot;) contains a single quote the value will be truncated until the caracter before the quote.

If I change from single quote to double quote next to value like this:
<input name=Comment type=text value=&quot;<%Response.write trim(rsInfo(&quot;Comment&quot;))%>&quot;>

then if rsInfo(&quot;Comment&quot;) will contain a double quote it will truncate again. If it contains a sinigle quote it will display it.

What should I do??
Thanks,
Duruguru
 
You could replace any occurances of the &quot; or ' using the replace command.

var1=Replace(var1, &quot;'&quot;, &quot;&quot;)

Or you could split the variable if the quotes are only at the beginning and end so that you could put them back when you are done.

Those are just a couple of possible options that I can think of. I am relatively new to ASP, so maybe someone else will give a better solution?

clofton
 
I found the solution:

Replace(rsInfo(&quot;Comment&quot;),&quot;&quot;&quot;&quot;,&quot;''&quot;)

Thanks anyway!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top