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

data not displayed after space

Status
Not open for further replies.

JanS

Technical User
Feb 21, 2001
77
AU
Hi,

I am dynamically loading data from a database into textboxes when a page is loaded. All is fine apart from one particular database field. Any data after a space in this field is not dispalyed in the textbox. ie "Sample Data" is displayed as "Sample"

The code im using to load the value into the textbox is:

<INPUT size=50 type=&quot;text&quot; id=text1 name=reportname readonly=true align=middle value=<%Response.Write rs1(&quot;report_name&quot;)%>>

Any ideas what could be wrong?

Best regards
jan
 
show us how you fill rs1 :)

also try super-simplifying that line, ie:
Code:
<input type=&quot;text&quot; name=&quot;reportname&quot; value=<%=rs1(&quot;report_name&quot;)%>>




Posting code? Wrap it with code tags: [ignore]
Code:
[/ignore][code]CodeHere
[ignore][/code][/ignore].
 
It's standard HTML behavior -- without double-quotes the value ends at the space (think about what the tag looks like when it's done... the browser sees everything after the space as an additional tag attribute).

Instead use:
Code:
<INPUT size=50 type=&quot;text&quot; id=text1 name=reportname readonly=true align=middle value=
Code:
&quot;
Code:
<%Response.Write rs1(&quot;report_name&quot;)%>
Code:
&quot;
Code:
>
Note, too, that there's a shortcut in ASP for Response.Write as a tag... instead of <% use <%=, like this:
Code:
<INPUT size=50 type=&quot;text&quot; id=text1 name=reportname readonly=true align=middle value=&quot;
Code:
<%=
Code:
rs1(&quot;report_name&quot;)%>&quot;>
 
JanS, both answers you got above should work 100%... try them and they should work, I suggest putting double double-quotes like clarkin used in his sample, and Genimuse explained.. Genimuse didn't use double quotes on all of them because he knows where he needs to use them and where not, but if you are confused, just use the sample clarkin showed you. I understand where to put them and where not, but I still use the one clarkin uses, its very safe, and work perfectly fine.

Here is one input field from my page:

<input name=&quot;inputRevenue&quot; type=&quot;text&quot; id=&quot;inputRevenue&quot; value=&quot;<%=offerRS(&quot;Revenue&quot;)%>&quot; size=&quot;10&quot; tabindex=&quot;1&quot; maxlength=&quot;8&quot;>
 
Just a note that I always use double quotes around everything too, and also suggest it. (For my example I didn't want to confuse anything so I left the others out just in case.) This is indeed best:
Code:
<INPUT size=&quot;50&quot; type=&quot;text&quot; id=&quot;text1&quot; name=&quot;reportname&quot; readonly=&quot;true&quot; align=&quot;middle&quot; value=&quot;<%=rs1(&quot;report_name&quot;)%>&quot;>
 
Oh, and even better is to HTMLEncode the value just in case it includes its own double quote or greater-than or less-than signs or such (which will also mess up the HTML):
Code:
<INPUT size=&quot;50&quot; type=&quot;text&quot; id=&quot;text1&quot; name=&quot;reportname&quot; readonly=&quot;true&quot; align=&quot;middle&quot; value=&quot;<%=Server.HTMLEncode(rs1(&quot;report_name&quot;))%>&quot;>
 
Thanks to all - I should have realised it would be something simple like this.

jan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top