www.webdeveloper.com
Results 1 to 6 of 6

Thread: Asp problem returning data from Session in an Input statement

  1. #1
    Join Date
    Sep 2004
    Posts
    36

    Asp problem returning data from Session in an Input statement

    I have an asp page trying to display data from a sql database. The database has a field where there are 2 words in a record (i.e. Web Developer). When I do a response.write Session("title"), I get everything in the field, (i.e. Web Developer). When I place the same code into my <input> statement, it only returns Web and not anything after a [SPACE]. Can someone please tell me what I need to do to get the whole result and not just partial??

    Code:
    <input  maxlength=60 size=40 value=<%=Session("title")%> class=body disabled>
    Thanks,

    Jeff
    Last edited by jazzyj99; 10-06-2006 at 09:56 AM. Reason: fixed code

  2. #2
    Join Date
    Dec 2005
    Posts
    155
    Your code should work , no need to do any thing unless the css class=body has some ficed length assigned to it
    vanamali Juvvadi
    i have brains but sold it on ebay

  3. #3
    Join Date
    Sep 2004
    Posts
    36

    Still doesn't work

    It should work, but for some glitch it isn't. I even took my css style out of it.
    Any ideas??? Please help.

  4. #4
    Join Date
    Dec 2005
    Posts
    155
    try to write response.write after the input statement, and see the value.
    or post your page code here , we will see if there is a problem
    vanamali Juvvadi
    i have brains but sold it on ebay

  5. #5
    Join Date
    May 2005
    Location
    Detroit, MI
    Posts
    11
    Quote Originally Posted by jazzyj99
    I have an asp page trying to display data from a sql database. The database has a field where there are 2 words in a record (i.e. Web Developer). When I do a response.write Session("title"), I get everything in the field, (i.e. Web Developer). When I place the same code into my <input> statement, it only returns Web and not anything after a [SPACE]. Can someone please tell me what I need to do to get the whole result and not just partial??

    Code:
    <input  maxlength=60 size=40 value=<%=Session("title")%> class=body disabled>
    Add quotes (single or double, just be consistent) around the <%..%> tags, like this:
    Code:
    <input  maxlength=60 size=40 value='<%=Session("title")%>' class=body disabled>
    so the HTML looks like this:
    Code:
    <input maxlength=60 size=40 value='word1 word2' class=body disabled>
    What's happening is that the browser is seeing this (for example):
    Code:
    <input maxlength=60 size=40 value=word1 word2 class=body disabled>
    so it's interpreting the value of the textbox as "word1", and ignoring "word2" (or rather, most browsers will treat it like an element property, and only ignore it if it's not a recognized property of a textbox).

  6. #6
    Join Date
    Sep 2004
    Posts
    36

    Beautiful. thanks it worked great:)

    Thanks for your assistance

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles