Click to See Complete Forum and Search --> : Asp problem returning data from Session in an Input statement


jazzyj99
10-06-2006, 10:06 AM
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??

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

Thanks,

Jeff

jvanamali
10-06-2006, 10:32 AM
Your code should work , no need to do any thing unless the css class=body has some ficed length assigned to it

jazzyj99
10-06-2006, 10:54 AM
It should work, but for some glitch it isn't. I even took my css style out of it.
Any ideas??? Please help.

jvanamali
10-06-2006, 11:51 AM
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

Gerald Bocci
10-09-2006, 02:12 PM
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??

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


Add quotes (single or double, just be consistent) around the <%..%> tags, like this:
<input maxlength=60 size=40 value='<%=Session("title")%>' class=body disabled> so the HTML looks like this:
<input maxlength=60 size=40 value='word1 word2' class=body disabled>

What's happening is that the browser is seeing this (for example):
<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).

jazzyj99
10-09-2006, 04:36 PM
Thanks for your assistance:) :) :) :) :) :)