Database Register
Script for Editing
The file you set in the database register’s value Edit, will be called by Consolo when the user clicks on a row in the list.
Request sent to the script by POST:
- Consolo sends the password in the configuration as a variable password. Verify it in the script.
- Consolo will send an ID-value to the script. The value is retrieved from the first column in the Script for listing. If a new post is created in the register, Consolo will also call this script, but without the ID-value. The script should then return the same forms, but without any data.
Response is expected according to Consolo’s xml-defined forms »
Exemple
This example illustrates how to create a script for editing in SQL-connected ASP. If you are using another environment on your server, please translate the script to the suitable language.
This example creates a form with information on a member in a member register. Note that the password sent by Consolo is verified on row 4.
<%Response.ContentType = "text/xml"%>
<?xml version='1.0' encoding='ISO-8859-1'?>
<!-- #INCLUDE VIRTUAL='/consolo/db_opendb.asp' -->
<% If Request("password") <> "abc123" Then Response.End
tId = Request("id") & ""
If tId <> "" Then
' Retrieve data from database
Set RS = Connect.Execute("SELECT * FROM Presscutting_T WHERE Presscutting_ID = " & tId & ";" )
aTitle = Server.URLEncode(RS("Title_VC"))
aText = Replace(RS("Text_VC"), "<br>", vbcrlf)
aText = Replace(aText, "“", """")
aText = Replace(aText, "”", """")
aText = Replace(aText, "–", "-")
aText = Server.URLEncode(aText)
aDate = Server.URLEncode(RS("Date_VC"))
aNewsPaper = Server.URLEncode(RS("Newspaper_VC"))
RS.Close
Set RS = Nothing
End If
%>
<DATA>
<Title_VC type="text" caption= "Title"maxlength="150"><%=aTitle%></Title_VC>
<Text_VC type="textarea" caption= "Text"maxlength="2500"><%=aText%></Text_VC>
<Date_VC type="date" caption= "Date"autochange="0"><%=aDate%></Date_VC>
<Newspaper_VC type="text" caption= "Newspaper"maxlength="50"><%=aNewsPaper%></Newspaper_VC>
</DATA>
<%
'' Close database
Connect.Close
Set Connect = Nothing
%>