View Full Version : Text Wraping
Da_Rockwiler
05-23-2003, 11:46 AM
Ok I need some help........I created a basic website with some ASP code to pull records from a database and also to add records to a database........my problem is hard to explain, but here goes
Before I started creating the page the database already had 600 records in it so when I do a seach it pulls the records from the DB fine and places them into a nice html table, the problem is now when I enter a record using the form on the webpage when I do a seach of that record, the text does not wrap it just extengs my table out past the page forcing people to scroll........I don't understand why the records that were previously in the database wrap around and fit on the page, but the records I enter throught the form I created on the webpage will not!!! HELP ME PLEASE..........I can give a url if somebody wants to take a look...........thanx
Angelika
05-23-2003, 11:57 AM
OK! Give a url and code too.
Da_Rockwiler
05-23-2003, 12:13 PM
http://morellcap.peicaps.org/Alumni_Test/index.html
go to "select Year" from the drop down list chose 1990 and scroll down til you come to the name "Marshall Mathers"..........this was a record I enter through the html form on the site
here's the code
<%@Language=VBScript%>
<html>
<body background="graduate_hat.gif" vlink="green" alink="green" link="green">
<font face="Tahoma" size="4" color="green"><b><u>Alumni Information</u></b></font><br><br>
<%
Dim SearchText, MyConn, SQL, RS, i
SearchText = Request.Form("GraduationYear")
Set MyConn=Server.CreateObject("ADODB.Connection")
MyConn.Open = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("Alumni.mdb") & ";Persist Security Info=False"
'MyConn.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\Databases\demo.mdb"
SQL = "Select FirstName, LastName, Address, HomePhone, EmailName, GraduationYear, EducationalBackground, Career, FamilyStatus, HobbiesInterests"
SQL = SQL & " From tblAlumni Where tblAlumni.GraduationYear Like '%"&SearchText&"%'"
SQL = SQL & " ORDER BY LastName"
Set RS = MyConn.Execute(SQL)
Response.Write "<table width=""500"" border=""0"">"
Response.Write "<tr><td colspan=2><hr width=90% size=3 color='green'></td></tr>"
response.Write "<tr>"
while not RS.EOF
For i = 0 To RS.Fields.Count - 1
Response.Write "<td valign='top'><b><font face='Tahoma' size=2>" & RS(i).Name &"</font></b></td>"
Response.Write "<td>" & RS(i) & "</td>"
Response.Write "</tr>"
Next
Response.write "<tr><td colspan=2><hr width=90% size=3 color='green'></td></tr>"
'While Not RS.EOF
'Response.Write "<tr>"
'For i = 0 To RS.Fields.Count - 1
'Response.Write "<td>" & RS(i) & "</td>"
'Next
'Response.Write "</tr>"
RS.MoveNext
Wend
RS.Close
MyConn.Close
Set RS = Nothing
Set MyConn = Nothing
Response.Write "</table>"
%>
<br>
<center><font face="Tahoma" color="green"><a href="dropdown.asp"><b>Search Again</b></a></font></center>
</body>
</html>
Angelika
05-23-2003, 01:41 PM
My test page with your code works good.
This is my test page.
lors.Open"select * from table_name",loconn
Response.Write "<table width=""500"" border=""1"">"
Response.Write "<tr><td colspan=2><hr width=90% size=3 color='green'></td></tr>"
while not lors.EOF
For i = 0 To lors.Fields.Count - 1
response.Write "<tr>"
Response.Write "<td valign='top'><b><font face='Tahoma' size=2>" & lors(i).Name &"</font></b></td>"
Response.Write "<td>" & lors(i) & "</td>"
Response.Write "</tr>"
Next
Response.write "<tr><td colspan=2><hr width=90% size=3 color='green'></td></tr>"
lors.MoveNext
Wend
Let see one more time.
Da_Rockwiler
05-23-2003, 02:14 PM
Ok now it's really weird.......I have my text boxes in my form set at a max length of 250, so it will not take anymore than 250 characters........so what i just did was tested it by typing nonsense in the text box til it got to the max, then i hit submit and viewd my results and the text did not wrap on the results page, i did this for another text box with the same properties..........then I tested both boxes full of nonsense filled to their max length and I hit submit and wouldn't you know it, the text wrapped in the results page for both fields................so it won't wrap if one text box is empty and if they are both full it will wrap!!! I'm soooooooo confused!!!
Angelika
05-23-2003, 02:26 PM
Me too :-) !!!
I do not have all your code.
How about form code?
check your Request.Form(), DataType in DB.
Da_Rockwiler
05-23-2003, 02:43 PM
ok well here's the code to my 2 page, the form page which is a html page and the asp page that adds the values to the database
the same thing is happening with this page!!......
The HTML page
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>
Morell Regional High School Alumni Form
</title>
</head>
<body background="graduate_hat.gif">
<script language="Javascript">
<!-----Sets focus on first field
function setfocus() {
document.alumni.FirstName.focus();
return;
}
function formCheck()
{
if (document.alumni.FirstName.value == "")
{
alert("Please enter your First Name.");
return false;
}
if (document.alumni.LastName.value == "")
{
alert("Please enter your Last Name.");
return false;
}
if (document.alumni.GraduationYear.value == "")
{
alert("Please select the year you graduated.");
return false;
}
}
//---->
</script>
<body onload="setfocus()">
<form name="alumni" method="POST" action="add_to_alumni2.asp" onSubmit="return formCheck()">
<table border="0" align="center" width="650" cellpadding=2 cellspacing=5>
<tr>
<td><font size=4 face="Tahoma" color="green"><b><u>Please Enter Your Information</u></b></font></td>
</tr>
<tr>
<td><b>*</b><font size=3 face="Tahoma" color="green"> Indicates Required Text Fields</font></td>
</tr>
</table>
<table border="0" align="center" width="650" cellpadding=2 cellspacing=5>
<tr>
<td>
<b>*<font size="3" color="green"> First Name:</b></font>
</td>
<td>
<input type="TEXT" name="FirstName" maxlength="25" size="25">
</td>
<td width=118>
<b>*<font size="3" color="green"> Last Name:</b></font>
</td>
<td>
<input type="TEXT" name="LastName" maxlength="40" size="25">
</td>
</tr>
<tr>
<td>
<b><font size="3" color="green">Street Address:</b></font>
</td>
<td>
<input type="TEXT" name="Address" maxlength="60" size="25">
</td>
<td>
<b><font size="3" color="green">Phone Number:</b></font>
</td>
<td>
<input type="TEXT" name="HomePhone" maxlength="30" size="15"><br>
</td>
</tr>
</tr>
<td valign="top">
<b><font size="3" color="green">Email Address:</b></font>
</td>
<td valign="top">
<input type="TEXT" name="EmailName" maxlength="50" size="25"><br>
</td>
<td>
<b>* <font size="3" color="green">Graduation Year:</b></font><br>
</td>
<td valign="top">
<select size="1" name="GraduationYear">
<option selected>--Select Year--</option>
<option value="2002">2002</option>
<option value="2001">2001</option>
<option value="2000">2000</option>
<option value="1999">1999</option>
<option value="1998">1998</option>
<option value="1997">1997</option>
<option value="1996">1996</option>
<option value="1995">1995</option>
<option value="1994">1994</option>
<option value="1993">1993</option>
<option value="1992">1992</option>
<option value="1991">1991</option>
<option value="1990">1990</option>
<option value="1989">1989</option>
<option value="1988">1988</option>
<option value="1987">1987</option>
<option value="1986">1986</option>
<option value="1985">1985</option>
<option value="1984">1984</option>
<option value="1983">1983</option>
<option value="1982">1982</option>
<option value="1981">1981</option>
<option value="1980">1980</option>
<option value="1979">1979</option>
<option value="1978">1978</option>
<option value="1977">1977</option>
<option value="1976">1976</option>
<option value="1975">1975</option>
<option value="1974">1974</option>
<option value="1973">1973</option>
<option value="1972">1972</option>
<option value="1971">1971</option>
<option value="1970">1970</option>
<option value="1968">1969</option>
<option value="1968">1968</option>
<option value="1967">1967</option>
<option value="1966">1966</option>
<option value="1965">1965</option>
<option value="1964">1964</option>
<option value="1963">1963</option>
<option value="1962">1962</option>
<option value="NeverGraduated">n/a</option><br>
</td>
</tr>
<tr>
<td></td>
<td></td>
<td colspan="2" valign="top"><font size=2 face="Tahoma">(select "n/a" if you have not graduated)</font></td>
</tr>
</table>
<br>
<table border="0" align="center" width="600" cellpadding=0 cellspacing=5>
<tr><td colspan=2><font face="Tahoma" size=3><u><font color="green">Optional Information</u><br></font></td></tr>
<tr>
<td valign="top" align="left" width=148>
<b><font size="3" color="green">Educational Background:</b></font>
</td>
<td align="left">
<input type="TEXT" name="EducationalBackground" maxlength="200" size="60">
</td>
</tr>
<tr>
<td valign="top" align="left" >
<b><font size="3" color="green">Career:</b></font>
</td>
<td valign="top" align="left">
<input type="TEXT" name="Career" maxlength="200" size="60">
</td>
</tr>
<tr>
<td valign="top" align="left">
<b><font size="3" color="green">Family Status:</font>
</td>
<td valign="top" align="left">
<input type="TEXT" name="FamilyStatus" maxlength="100" size="60">
</tr>
<tr>
</td>
<td align="left" valign="top">
<b><font size="3" color="green">Hobbies/Interests:</b></font>
</td>
<td align="left" valign="top">
<input type="TEXT" name="HobbiesInterests" maxlength="200" size="60"></textarea>
</tr>
<tr>
<td colspan=2 align="right" valign="top">
<input type="Submit" value="Submit"><input type="Reset" value="Reset">
</td>
</tr>
</tr>
</table>
</form>
</body>
</html>
Da_Rockwiler
05-23-2003, 02:43 PM
Sorry here's the asp page
the ASP page
<%@ Language = "VBScript"%>
<%
'Declare all local variables
dim conn
dim rs
dim strconn
dim strsql
'set connection string to local variable-I use a DSN-less connection
strconn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("Alumni.mdb") & ";Persist Security Info=False"
'Create the Connection object
set conn = server.createobject("adodb.connection")
conn.open strconn
'Create the recordset object
set rs = server.createobject("adodb.recordset")
'This statement opens the table so we can add a record notice the addnew
'The 2, 2 is how the table is opened there are many ways it can be opened
rs.open "tblAlumni", conn, 2, 2
'Use the addnew method of the recordset object to add a record
rs.addnew
'Set the table column = to my input text box from my form
rs("FirstName") = request("FirstName")
rs("LastName") = request("LastName")
rs("Address") = request("Address")
rs("HomePhone") = request("HomePhone")
rs("EmailName") = request("EmailName")
rs("GraduationYear") = request("GraduationYear")
rs("EducationalBackground") = request("EducationalBackground")
rs("Career") = request("Career")
rs("FamilyStatus") = request("FamilyStatus")
rs("HobbiesInterests") = request("HobbiesInterests")
rs.update
'I do a movelast here to get the ID that is automatically generated
'I also set the value to a local variable so I can write out to the database
rs.movelast
%>
<html>
<head>
<title>Alumni Summary</title>
</head>
<body Background="graduate_hat.gif" vlink="green" alink="green" link="green">
<font face="Tahoma" size="4" color="green"><b>The following information has been added to the database!</b></font><br><br>
<TABLE border=0 width=600>
<tr>
<td align="right" valign="top" width=148><font color="green" size="3"><b>First Name:</b></font></td>
<td align="left"><% = request("FirstName") %></td>
</tr>
<tr>
<td align="right" valign="top"><font color="green" size="3"><b>Last Name:</b></font></td>
<td align="left"><% = request("LastName") %></td>
</tr>
<tr>
<td align="right" valign="top"><font color="green" size="3"><b>Address:</b></font></td>
<td align="left"><% = request("Address") %></td>
</tr>
<tr>
<td align="right" valign="top"><font color="green" size="3"><b>Phone Number:</b></font></td>
<td align="left"><% = request("HomePhone") %></td>
</tr>
<tr>
<td align="right" valign="top"><font color="green" size="3"><b>Email Address:</b></font></td>
<td align="left"><% = request("EmailName") %></td>
</tr>
<tr>
<td align="right" valign="top"><font color="green" size="3"><b>Graduation Year:</b></font></td>
<td align="left"><% = request("GraduationYear") %></td>
</tr>
<tr>
<td align="right" valign="top"><font color="green" size="3"><b>Educational Background:</b></font></td>
<td align="left"><% = request("EducationalBackground") %></td>
</tr>
<tr>
<td align="right" valign="top"><font color="green" size="3"><b>Career:</b></font></td>
<td align="left"><% = request("Career") %></td>
</tr>
<tr>
<td align="right" valign="top"><font color="green" size="3"><b>Family Status:</b></font></td>
<td align="left"><% = request("FamilyStatus") %></td>
</tr>
<tr>
<td align="right" valign="top"><font color="green" size="3"><b>Hobbies/Interests:</b></font></td>
<td align="left"><% = request("HobbiesInterests") %></td>
</tr>
<tr>
<td><p> </p></td>
</tr>
<tr>
<td colspan=2 align="center">
<font face="Tahoma" color="green"><a href="main.html">Home</a> | <a href="enter_info.html">Enter Information</a></font>
</td>
</tr>
</table>
</body></html>
<%
' set your objects to nothing. This clears them out of servers memory
set rs= nothing
set conn = nothing
%>
Angelika
05-23-2003, 03:47 PM
I'm confused!!!
Check this out! (This is not our problem.)
<td align="left" valign="top">
<input type="TEXT" name="HobbiesInterests" maxlength="200" size="60">
</textarea>????
</td>
</tr>
I know you need this as soon as possible, but I need more time.
Zebulin
05-25-2003, 11:35 PM
It wouldnt wrap if there are no spaces in the string !!
The following string WONT wrap.. as it got no spaces in it
-------------------------------------------------
ldkfjdsrklueoriujdifojdkljfkldjsrueoirjfjdffkjdslrueoirueiorudjfdkljfkdluroeirueiofjdklfuroewurioeurfjdkfjdkueoirueiojfdkfj
try giving in a few spaces and it would !
-------------------------------------------------
ldkfjd srklueoriuj difojdkljfkldj srueoirjfjd ffkjdslrue oirueioru djfdkljfkdl uroeirue iofjdklfuro ewurioeurf jdkfjdkueoiru eiojfdkfj
is this it ?
vBulletin v3.0.3, Copyright ©2000-2012, Jelsoft Enterprises Ltd.