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

text input box data truncated (darn it!) 1

Status
Not open for further replies.

OrthoDocSoft

Programmer
May 7, 2004
291
0
0
US
Hi, I'm very new to ASP.....

This is my code on an ASP page. I am using the response.write method to create an entire HTML page. The code executes just fine (so please ignore the missing and inappropriate "xxx _" bits that are not a problem). Previously on this page in code, I have "read" the numerous objCRS(n) from a database (which appears to work).

My problem is that the text output of any field below which
has more than a single word in it (for example, an address which holds "123 Elm Lane" will be truncated to show only the first "word" in the line, in this example, "123".

I know that the database "read" is OK because the first part of the code below simply prints out the data on the browser page and it is all there. But try to get it all in the text boxes....problems.

Also, I am not talking about what happens when the SUBMIT button (here called "Update Information")is clicked, which calls yet another ASP page which works just fine.

Like others have suggested in this forum, I have tried enclosing all objCRS(n) in double quotes like "objCRS("StreetAddress")", and single quotes 'objCRS("StreetAddress")' but that causes a run error.

Can anyone help me with this problem?

Response.Write _
"<html><head><title>ODS, Inc. CBCI 1.0</title></head>" _
& "<body>" _
& "<form name='submitpurchasenotepad' Method=Post Action='updatecustomer.asp'onSubmit='return validate();'>" _
& "<table><tr><img src=' width='900' height='90' border='0'></tr>" _
& "<B><tr>Your Information:</tr><tr></tr><tr>" _
& objCRS("Title") & " " & objCRS("FirstName") & " " _
& objCRS("MiddleInitial") _
& " " & objCRS("LastName") & "</tr><tr>" & objCRS("CareOf") & "</tr><tr> " _
& objCRS("StreetAddress") _
& "</tr><tr> " & objCRS("City") & " " & objCRS("State") & " " _
& objCRS("ZipCode") _
& "</tr><tr>" & objCRS("EmailAddress") & "</tr><tr> " & objCRS("PhoneNumber") & "</tr><tr> " _
& objCRS("Password") _
& "</tr></table>" _
& "</B>" _
& "<table>" _
& "<tr>Enter any changes below</tr>" _
& "<tr>Title: " & "<Input type='TEXT' NAME='Title' VALUE=" & objCRS("Title") & " size='4'></tr>" _
& "<tr>First Name: " & "<Input type='TEXT' NAME='FirstName' VALUE=" & objCRS("FirstName") & " size='26'></tr>" _
& "<tr>Middle Initial: " & "<Input type='TEXT' NAME='MiddleInitial' VALUE=" & objCRS("MiddleInitial") & " size='1'></tr>" _
& "<tr>Last Name: " & "<Input type='TEXT' NAME='LastName' VALUE=" & objCRS("LastName") & " size='26'></tr>" _
& "<tr>Care of: " & "<Input type='TEXT' NAME='CareOf' VALUE=" & objCRS("CareOf") & " size='26'></tr>" _
& "<tr>Street Address: " & "<Input type='TEXT' NAME='StreetAddress' VALUE=" & objCRS("StreetAddress") & " size='26'></tr>" _
& "<tr>City: " & "<Input type='TEXT' NAME='City' VALUE=" & objCRS("City") & " size='26'></tr>" _
& "<tr>State: " & "<Input type='TEXT' NAME='State' VALUE=" & objCRS("State") & " size='2'></tr>" _
& "<tr>Email Address: " & "<Input type='TEXT' NAME='EmailAddress' VALUE=" & objCRS("EmailAddress") & " size='26'></tr>" _
& "<tr>ZipCode: " & "<Input type='TEXT' NAME='ZipCode' VALUE=" & objCRS("ZipCode") & " size='5'></tr>" _
& "<tr>PhoneNumber: " & "<Input type='TEXT' NAME='PhoneNumber' VALUE=" & objCRS("PhoneNumber") & " size='26'></tr>" _
& "<tr>Password: " & "<Input type='TEXT' NAME='Password' VALUE=" & objCRS("Password") & " size='26'></tr>" _
& "</table>" _
& "<Input Type=SUBMIT Value='Update information'>" _
& "</form></body></html>"

Thank you for your help,

Ortho [sad]
 
You still need the double quotes, just not the way you tried to use them. Here's how your input lines should look.

Your existing line:
Code:
"<Input type='TEXT' NAME='ZipCode' VALUE=" & objCRS("ZipCode") & " size='5'>
The corrected version (I also corrected other single quotes to double quotes, which is better HTML but not mandatory):
Code:
"<Input type="TEXT" NAME="ZipCode" VALUE=[b][COLOR=red]""[/color][/b]" & objCRS("ZipCode") & "[b][COLOR=red]""[/color][/b] size="5">
 
BTW, your page will run WAY faster if you don't use Respone.Write, but rather just use regular HTML and insert your ASP stuff inside little <%=thingHere%> tags. Here's an example:
Code:
<tr>Title:  <Input type="TEXT" NAME="Title" VALUE="<%=objCRS("Title")%>" size="4"></tr>
These little things <%=yourASPthingHere%> serve as mini Response.Writes that you can insert into regular HTML.

The primary advantage is speed -- concatenating a great big long string like you have in your Response.Write takes a ton of processing time -- and the secondary advantage is that your code will be much more readable and easier to debug.
 
Genimuse

Out of interest, is that method faster than having the server jump in and out of the ASP Scripting Engine? I was always led to believe that multiple blocks of ASP was more inefficient.

Tony
________________________________________________________________________________
 
Timed tests indicate that the slowest is Response.Write, faster is jumping in and out of ASP, and even faster is the "inline" writes. The results surprised me, too -- I assumed that changing context would be the winner. There's a thread here that's only about a month old where Tarwn ran quite a few trials. I should have bookmarked it.
 
Genimuse,

That was magic! THANK YOU! Star for you.

I will think about what you said in your second post. I am still struggling with how to efficiently transfer variable values from an ASP page to an HTML page. This whole affair is so very CLUNKY.

Much appreciation to you. [bigsmile]

Ortho
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top