Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2004
    Posts
    41

    Unanswered: 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.

  2. #2
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    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 &"'>")
    %>

  3. #3
    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.

  4. #4
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    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 '

Posting Permissions

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