This week I implemented a grid style application using Classic ASP and Jeditable. The hardest part of implementing this application was trying to figure out what a save.asp version of save.php would look like. Here the template I created.
<%
dim sID, sValue,errorcode dim field1,field2,field3,field4
'The sID is a spreadsheet style ID
'As an example B3 would be the second editable field
'for DB ID field = 3
sID = request("id")
sValue = request("value")
sType = mid(sID,1,1)
sDataID = mid(sID,2)
'We have four editable fields
'The changed field will not be null
field1 = null
field2 = null
field3 = null
field4 = null
errorcode = 0
select case sType
case "A"
field1 = sValue
case "B"
field2 = sValue
case "C"
field3 = sValue
case "D"
field4 = sValue
case else
errorcode = 1
end select
if errorcode = 0 then
'Validate and update the data base
end if
if errorcode = 0 then
'Send back the value field
Response.Write sValue
else
Response.Write "<b>!Error " & errorcode & "</b>"
end if
%>
No related posts.
Related posts brought to you by Yet Another Related Posts Plugin.
3 responses so far ↓
1 Dave // Mar 5, 2010 at 12:18 pm
I’m having this very same nightmare! I’m having trouble getting the values and ID’s from the form. Could you possibly post the form source code as well please?
2 Erik Sjon // May 11, 2010 at 10:31 am
1. I added an ID to the input elements of the jeditable source (i.e doubeclick)
doubleclick
2. I put two more parameters to the dblclick-editable-javascript (id and name)
$(“.dblclick”).editable(“save.asp”, {
indicator : “”,
tooltip : “Doubleclick to edit…”,
event : “dblclick”,
style : “inherit”,
id : ‘elementid’,
name : this.elementid
});
3. Then I changed the save.asp to:
<%
sID = request.form("elementid")
sValue = request.form("value")
errorcode = 0
if errorcode = 0 then
sql = " insert into test(test1, test2) values ('" & sID & "', '" & sValue & "')"
cn.execute(sql)
end if
if errorcode = 0 then
'Send back the value field
Response.Write sValue
else
Response.Write "!Error: ” & request.form & “ ” & “”
end if
%>
Hope this helps out.
- Erik
3 Ashley // Jun 29, 2010 at 4:23 am
can u share the source code of Classic ASP and Jeditable?
i find php but there is no asp code. can u share the codes and we will download it
thanks
Leave a Comment