Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

null session variables

Status
Not open for further replies.

cawthor

Programmer
May 31, 2001
89
US
I am assigning the contents of a text area to a session variable. If the user comes back to the page with the text area, I want to display the contents of the session variable, Eg:

<textarea name=&quot;address&quot; rows=&quot;3&quot; COLS=&quot;25&quot;>
<%=session(&quot;address&quot;)%>
</textarea>

My problem is this, the first time the user visits this page and tabs to the text area, the cursor is on the second line of the text area. It looks like 1 character (maybe a new line char?) is being displayed for the null session variable. I've tried putting an 'if' statement around it like below, but it still displays the cursor on line 2:

<textarea name=&quot;address&quot; rows=&quot;3&quot; COLS=&quot;25&quot;>
<%
if session(&quot;address&quot;) <> Null then
response.write session(&quot;address&quot;)%>
end if
%>
</textarea>

Does anyone know what char is being displayed by a null session variable?

Thanks.
 
<textarea name=&quot;address&quot; rows=&quot;3&quot; COLS=&quot;25&quot;>
<%=session(&quot;address&quot;)%>
</textarea>

When the above resolves with a NULL, the following HTML is delivered:

<textarea name=&quot;address&quot; rows=&quot;3&quot; COLS=&quot;25&quot;>

</textarea>

The blank line in between the textarea tags is causing the new line.

On the other hand, if the variable has contents:

<textarea name=&quot;address&quot; rows=&quot;3&quot; COLS=&quot;25&quot;>
randomtext
</textarea>

The HTML interpreter eliminates whitespace because there is text in between your tags.

Your problem should go away if you rewrite your tags as:

<textarea><%%></textarea>
 
Well don't I feel stupid :) I hate it when I over-complicate things!

Thanks for your response.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top