Advanced Layer Popup Support Product Page

This topic was archived

Call ALP after insert behavior ASP

Asked 27 Jul 2009 18:46:30
1
has this question
27 Jul 2009 18:46:30 Peter Deré posted:
Hi,

How can I call the ALP function after I did an insert behavior?

<
%Dim MM_editAction
MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
If (Request.QueryString <> "") Then
  MM_editAction = MM_editAction & "?" & Server.HTMLEncode(Request.QueryString)
End If

' boolean to abort record edit
Dim MM_abortEdit
MM_abortEdit = false
%>
<
%' IIf implementation
Function MM_IIf(condition, ifTrue, ifFalse)
  If condition = "" Then
    MM_IIf = ifFalse
  Else
    MM_IIf = ifTrue
  End If
End Function
%>
<
%If (CStr(Request("MM_insert")) = "Form1") Then
  If (Not MM_abortEdit) Then
    ' execute the insert
    Dim MM_editCmd

    Set MM_editCmd = Server.CreateObject ("ADODB.Command")
    MM_editCmd.ActiveConnection = MM_website_STRING
    MM_editCmd.CommandText = "INSERT INTO dbo.Table_1 (table_ID, table_field1, table_field2) VALUES (?, ?, ?)" 
    MM_editCmd.Prepared = true
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param1", 5, 1, -1, MM_IIF(Request.Form("Table_ID"), Request.Form("Table_ID"), null)) ' adDouble
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param2", 5, 1, -1, MM_IIF(Request.Form("Field1"), Request.Form("Field1"), null)) ' adDouble
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param3", 5, 1, -1, MM_IIF(Request.Form("Field2"), Request.Form("Field2"), null)) ' adDouble
    MM_editCmd.Execute
    MM_editCmd.ActiveConnection.Close

    --> HERE COMES THE CODE TO CALL THE ALP FUNCTION INSTEAD OF A PAGE REDIRECT <--

  End If
End If
%>

Edited by - Peter Deré on 27 Jul 2009  18:47:41

Replies

Replied 28 Jul 2009 10:12:36
28 Jul 2009 10:12:36 Kiril Iliev replied:
Hi Peter,

All you need to do is to attach the behavior to the form, and set its trigger event onSubmit.

After the form is submitted, ALP will appear with the address specified.

Regards,
Replied 28 Jul 2009 10:27:49
28 Jul 2009 10:27:49 Peter Deré replied:
Hi,

I tried that, but then in my ALP the "request.form" doesn't work...
And the insert isn't done.

So the page shows the ALP, but no insert is done...

Edited by - Peter Deré on 28 Jul 2009  11:04:26

Reply to this topic