Author |
Topic  |
|
redbrad0
Advanced Member
    
USA
3725 Posts |
Posted - 07 June 2001 : 08:46:16
|
ok i have a text field and i want it to display data with quotes in it that comes from a db, whats the best way to do this?
<% strSize = SQLdecode(rs("CF_Size")) %> <input type="text" name="strSize" value="<%=strSize%>" size="25">
Brad |
|
paco
Junior Member
 
Spain
187 Posts |
Posted - 07 June 2001 : 09:14:39
|
I think you already have it right.
|
 |
|
redbrad0
Advanced Member
    
USA
3725 Posts |
Posted - 07 June 2001 : 09:30:10
|
strSize = 29 7/16" x 29"
so therefor when it outputs the data for a text box it shows up like this....
<input type="text" name="strSize" value="29 7/16" x 29"" size="25">
whcih means all i can see in the text box is 29 7/16
Brad |
 |
|
big9erfan
Average Member
  
540 Posts |
Posted - 07 June 2001 : 09:33:38
|
I think you have to make sure that the string has "" double quotes instead of a single quote " to have it show up properly.
http://www.ugfl.net/forums |
 |
|
paco
Junior Member
 
Spain
187 Posts |
Posted - 07 June 2001 : 10:15:04
|
You could take out the quotes with replace and put some text like "inches", "in inches" ... after the text field.
You might also want to try replacing double quotes (") with two simple quotes (''). Sometimes it's difficult to know if you have a double quote or two singles.
|
 |
|
tilttek
Junior Member
 
Canada
333 Posts |
|
redbrad0
Advanced Member
    
USA
3725 Posts |
Posted - 07 June 2001 : 13:58:57
|
but what if they put in 6' x 23"
quote:
Change it for:
<% strSize = SQLdecode(rs("CF_Size")) %> <input type="text" name="strSize" value='%=strSize%>'size="25">
Philippe Gamache http://www.tilttek.com http://www.lapageamelkor.com
Brad |
 |
|
tilttek
Junior Member
 
Canada
333 Posts |
Posted - 07 June 2001 : 14:04:10
|
quote:
but what if they put in 6' x 23"
Hum, good question, I don't think there is a real way to do this except: <textarea cols="25" name="strSize" rows="1" wrap="none"><%=strSize%></textarea>
Philippe Gamache http://www.tilttek.com http://www.lapageamelkor.com |
 |
|
cevans
Junior Member
 
Canada
101 Posts |
Posted - 07 June 2001 : 15:31:31
|
Just replace any quotes in the string with the quote entity (& quot; with the space removed). This will cause the quotes inside the string to be treated as literals, and thus placed in the textbox, instead of having them treated as the end of your quoted text. Note that you don't have to do anything special about single quotes ('). Since your value attribute is enclosed in double quotes, the single quote character is already treated as a literal.
<% strSize = Replace(SQLdecode(rs("CF_Size")),"""","& quot;") %> <input type="text" name="strSize" value="<%=strSize%>" size="25">
Clark
Edited by - cevans on 07 June 2001 15:38:00 |
 |
|
redbrad0
Advanced Member
    
USA
3725 Posts |
Posted - 07 June 2001 : 21:21:58
|
thats what i was thinking, thanks for your input
Brad |
 |
|
Doug G
Support Moderator
    
USA
6493 Posts |
Posted - 07 June 2001 : 22:16:19
|
Server.HTMLEncode(strSize)
====== Doug G ====== |
 |
|
tilttek
Junior Member
 
Canada
333 Posts |
|
|
Topic  |
|