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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pecuilar Problem 1

Status
Not open for further replies.

AgentM

MIS
Jun 6, 2001
387
US
I have a string value that is retirved from the database.
This value has a space and some characters after it.
When I do a Response.Write all the characters are dispalyed.

But when I display it in a textbox using:-
Response.Write &quot;<Input type=text size=32 value=&quot; & strValue & &quot;>&quot;
Only the characters until the space are displayed.
The characters after the space are not displayed in the textbox.
The length of the string is much less than the size of the textbox

Any idea why?

Thank you
 
The answer is simple...

If there's a space inside a value of any input element (except for TEXTAREA), a browser thinks that the value is only the part before the space.

To solve the problem, just pu a set of quotes around the value:

Response.Write &quot;<Input type=text size=32 value=&quot;&quot;&quot; & strValue & &quot;&quot;&quot;>&quot;

Hope this helps <Dmitriy>
dbrom@crosswinds.net
 
Thank you that worked just great.
Instead of double quotes I had to use single quotes.

 
you can try like this

<Input type=text size=32 value=&quot; & trim(strValue) & &quot;>

I think this is resolve your problem
 
I alwaus write pure HTML so it should be


<Input type=text size=32 value=&quot;<%=strValue%>&quot;>

And your problem is solved.

Basically if from database value is coming
&quot;rushi shroff&quot; and if it contained in variable strValue then

if you write

<Input type=text size=32 value=<%=strValue%>>

Then in browser it will show as

Rushi

within a text box

But if you follow the above practice, it will display an entire name.(Personel experience !!)
Rushi Shroff Rushi@emqube.com
&quot;Life is beautiful.&quot;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top