If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > Textbox output is being truncated

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-18-04, 10:54
mturner mturner is offline
Registered User
 
Join Date: Feb 2004
Posts: 41
Textbox output is being truncated

I am retrieving data from an Access Database, where a field can contain two or more words. When the data was stored, I replaced all spaces with the "%" sign. I am then placing this data in a text box. The problem is that the data is being truncated after the first word. The code snippet is below:

<%
new_name = rs.Fields.Item("grp_name")
new_name = Replace(new_name, "%", " ")
Response.Write("<input name='group' type='text' id='group' size='25' maxlength='25' value = "& new_name &">")
%>

The data viewed in the database is (for example): Water Lillies

But the output in the text box is: Water

If I do a Response.Write (new_name) it outputs:

Water Lillies

What am I doing wrong?

Thanks for any help.
Reply With Quote
  #2 (permalink)  
Old 03-18-04, 15:25
rokslide rokslide is offline
Registered User
 
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
What happens if you wrap the output in quotes eg....
<%
new_name = rs.Fields.Item("grp_name")
new_name = Replace(new_name, "%", " ")
Response.Write("<input name='group' type='text' id='group' size='25' maxlength='25' value = '"& new_name &"'>")
%>
Reply With Quote
  #3 (permalink)  
Old 03-18-04, 16:06
mturner mturner is offline
Registered User
 
Join Date: Feb 2004
Posts: 41
I'll tell you what happens...

IT WORKS!

Thanks Rokslide.

Only been at this for 2 months (it shows), and I need a book that posseses all these tricks.

Thanks again.
Reply With Quote
  #4 (permalink)  
Old 03-18-04, 17:03
rokslide rokslide is offline
Registered User
 
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
glad to help. it's not really a trick though, it's more of a concept...

yes, you can have html attributes without quotes around them but you are not meant to. when you don't have quotes your attribute values must not contain certain characters because if they things may not work the way you want them to...

the best plan of attack IMO is to quote everything and personally I use " instead of '
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On