lewisdow
02-17-2005, 02:38 AM
Hi guys and gals,
I have a bit of a problem, I'm trying to display the contents of large fields within a text area, so that it can be edited and then posted back to be updated. The thing is the page works so long as you delet everything in the text area first, the field displays itself but if edits are made what seems to be hiden data drom the field prevents the new changes from being made. Esentially it works well but there are problems with the data as it goes in. Hopefully this makes sense, its a little hard to explain without screenshots of the blank spaces after the data.
Here is code.
Any help is much apprieciated.
First script is displaying data and the second is making the changes.
******************************************************
<%@LANGUAGE="VBSCRIPT"%>
<!-- #include file="DatabaseConnect2.asp" -->
<!-- #include virtual="/adovbs.inc" -->
<html>
<head>
<title>Untitled Document</title>
</head>
<body background="Upload/Pictures/MainBg.gif">
<%
dim objRs, strContent, strContent2
strContent = Request.Form("Update_Content")
strContent2 = Request.Form("Update_Content2")
Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.Open "Chapters", DataConn , , , adCmdTable
'strSQL = "SELECT * FROM Chapters WHERE Chapters.SubjectID='" & request.querystring("Subjects") & "'"
'set objRS = dataconn.execute(strSQL)
If objRS.EOF then
response.Write("Sorry, there does not seem to be an existing chapter, new chaptersIDs must be inputted directly.")
else
%>
<form name="Update_Details" method="post" action="Update_Database.asp" >
<TextArea Name = "Update_Content" Rows = "13" Cols = "80" >
<%
Response.Write objRS("Content1")
%>
</textarea>
<p>
<TextArea Name = "Update_Content2" Rows = "13" Cols = "80" >
<%
Response.Write objRS("Content2")
%>
</textarea>
<p>
<input type="reset"> <input type="submit" Value="Submit" onClick="update_database.asp">
</form>
</body>
</html>
<%
objRS.close
set objrs = nothing
dataConn.close
set objconn = nothing
end if
%>
************************************************
<%@LANGUAGE="VBSCRIPT"%>
<!-- #include file="DatabaseConnect2.asp" -->
<!-- #include virtual="/adovbs.inc" -->
<html>
<head>
<title>Untitled Document</title>
</head>
<body background="Upload/Pictures/MainBg.gif">
<%
dim objRs, strContent
strContent = Request.Form("Update_Content")
strContent2 = Request.Form("Update_Content2")
Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.Open "Chapters", DataConn , , adLockOptimistic, adCmdTable
ObjRS("Content1") = Request.Form("Update_Content")
ObjRS("Content2") = Request.Form("Update_Content2")
ObjRS.Update
objRS.close
Set objRS = Nothing
dataConn.close
Set dataConn = Nothing
%>
Changes Made !
</body>
</html>
I have a bit of a problem, I'm trying to display the contents of large fields within a text area, so that it can be edited and then posted back to be updated. The thing is the page works so long as you delet everything in the text area first, the field displays itself but if edits are made what seems to be hiden data drom the field prevents the new changes from being made. Esentially it works well but there are problems with the data as it goes in. Hopefully this makes sense, its a little hard to explain without screenshots of the blank spaces after the data.
Here is code.
Any help is much apprieciated.
First script is displaying data and the second is making the changes.
******************************************************
<%@LANGUAGE="VBSCRIPT"%>
<!-- #include file="DatabaseConnect2.asp" -->
<!-- #include virtual="/adovbs.inc" -->
<html>
<head>
<title>Untitled Document</title>
</head>
<body background="Upload/Pictures/MainBg.gif">
<%
dim objRs, strContent, strContent2
strContent = Request.Form("Update_Content")
strContent2 = Request.Form("Update_Content2")
Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.Open "Chapters", DataConn , , , adCmdTable
'strSQL = "SELECT * FROM Chapters WHERE Chapters.SubjectID='" & request.querystring("Subjects") & "'"
'set objRS = dataconn.execute(strSQL)
If objRS.EOF then
response.Write("Sorry, there does not seem to be an existing chapter, new chaptersIDs must be inputted directly.")
else
%>
<form name="Update_Details" method="post" action="Update_Database.asp" >
<TextArea Name = "Update_Content" Rows = "13" Cols = "80" >
<%
Response.Write objRS("Content1")
%>
</textarea>
<p>
<TextArea Name = "Update_Content2" Rows = "13" Cols = "80" >
<%
Response.Write objRS("Content2")
%>
</textarea>
<p>
<input type="reset"> <input type="submit" Value="Submit" onClick="update_database.asp">
</form>
</body>
</html>
<%
objRS.close
set objrs = nothing
dataConn.close
set objconn = nothing
end if
%>
************************************************
<%@LANGUAGE="VBSCRIPT"%>
<!-- #include file="DatabaseConnect2.asp" -->
<!-- #include virtual="/adovbs.inc" -->
<html>
<head>
<title>Untitled Document</title>
</head>
<body background="Upload/Pictures/MainBg.gif">
<%
dim objRs, strContent
strContent = Request.Form("Update_Content")
strContent2 = Request.Form("Update_Content2")
Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.Open "Chapters", DataConn , , adLockOptimistic, adCmdTable
ObjRS("Content1") = Request.Form("Update_Content")
ObjRS("Content2") = Request.Form("Update_Content2")
ObjRS.Update
objRS.close
Set objRS = Nothing
dataConn.close
Set dataConn = Nothing
%>
Changes Made !
</body>
</html>