Welcome to WebmasterWorld Guest from 50.16.31.61

Forum Moderators: open

Loading Saved Data in Jeditable (Jquery plugin) in Classic ASP

Loading Saved Data in Jeditable (Jquery plugin) in Classic ASP

   
6:22 pm on Feb 24, 2011 (gmt 0)

10+ Year Member



Hi,
In Classic ASP (VB), I'm working with the Jquery plugin, "Jeditable," which allows the user to 'edit in place.' While I've got the code to save to the database, I'm having problems in getting the saved data to appear in the page, barring a page reload, which defeats the main purpose of using Jquery/Ajax.

Also, getting the data to appear in the editable textarea without html markup (such as '<br>') has been a challenge....

Thanks for any help or ideas - much appreciated.

---------------
Here's the code for the 2 pages I have:

index.asp

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<% strConnectDB = "Test_a" %>
<!--#include virtual="ConnectDB.asp"-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>Untitled Document</title>

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript" charset="utf-8"></script>

<script src="jquery_editable/jquery.jeditable.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">

$(document).ready(function() {
$(".editable_textile").editable("update_record.asp", {
indicator : "<img src='indicator.gif'>",
id : 'elementid',
name : 'newvalue',
type : 'textarea',
submit : "OK",
cancel : "Cancel",
tooltip : "Click to edit...",
height : "80px",
width : "175px",
data: function(value, settings) {
var retval = value.replace(/<br[\s\/]?>/gi, '\n');
return retval;
}

});
});
</script>

</head>

<body>
<%strSQL="Select * FROM AMS_test Where NotesID = '282'"%>
<!--#include virtual="QryDbCommand.asp"-->
<%strNotesDesc=objComm("NotesDesc")%>
<%strNotesDesc=Replace(Replace(Replace(strNotesDesc, "''", "'"),chr(10),"<br>"),chr(13),"<br>")%>

<div class="editable_textile" id="paragraph_2"><%=strNotesDesc%></div>

</body>
</html>
<!--#include virtual="DisconnectDB.asp"-->






update_record.asp

<%
editable_textile=request.Form("newvalue")

if editable_textile<>"" then

Dim updatedb
Set updatedb = Server.CreateObject("ADODB.Connection")

strConnString = .....



updatedb.ConnectionString = strConnString
updatedb.Open

str_editable_textile=Replace(editable_textile , "'","''")
str_editable_textile=Replace(str_editable_textile,"<br>",chr(10))
str_editable_textile=Replace(str_editable_textile,"<br>",chr(13))
sqlupdate = "UPDATE AMS_test SET NotesDesc = '" & str_editable_textile & "' where NotesID = '282'"


updatedb.Execute sqlupdate
updatedb.Close
Set updatedb = Nothing

'response.Write(editable_textile)
%>

<%
strSQL="Select * FROM AMS_test Where NotesID = '282'"%>
<!--#include virtual="QryDbCommand.asp"-->
<%strNotesDesc=objComm("NotesDesc")%>
<%strNotesDesc=Replace(Replace(Replace(strNotesDesc, "''", "'"),chr(10),"<br>"),chr(13),"<br>")
%>

<%
end if
%>
 

Featured Threads

Hot Threads This Week

Hot Threads This Month