%@LANGUAGE="VBSCRIPT"%>
<%
'Make a transaction dispatcher instance
Dim tNGs: Set tNGs = new tNG_dispatcher
tNGs.Init ""
%>
<%
' Start trigger
Dim formValidation: Set formValidation = new tNG_FormValidation
formValidation.Init
formValidation.addField "first_name", true, "text", "", "", "", "Please enter your first name."
formValidation.addField "last_name", true, "text", "", "", "", "Please enter your last name."
formValidation.addField "email", true, "text", "email", "", "", "Please enter a valid email address."
formValidation.addField "phone", true, "regexp", "^\d{10}$", "", "", "Please enter a 10 digit phone number."
formValidation.addField "booking_date", true, "date", "", "", "", "Please enter the date of the booking."
formValidation.addField "booking_time", true, "text", "", "", "", "Please enter the time of the booking."
formValidation.addField "guests", true, "numeric", "", "0", "999", "Please enter the number of guests."
tNGs.prepareValidation formValidation
' End trigger
%>
<%
'start Trigger_SendEmail trigger
'remove this line if you want to edit the code by hand
Function Trigger_SendEmail (ByRef tNG)
Dim emailObj: Set emailObj = new tNG_Email
emailObj.Init tNG
emailObj.setFrom "{KT_defaultSender}"
emailObj.setTo "info@manbo.com.au"
emailObj.setCC ""
emailObj.setBCC "lee@firthcomputerservices.com.au"
emailObj.setSubject "Online Booking"
'FromFile method
emailObj.setContentFile "booking.html"
emailObj.setEncoding "ISO-8859-1"
emailObj.setFormat "HTML/Text"
emailObj.setImportance "Normal"
Set Trigger_SendEmail = emailObj.Execute()
End Function
'end Trigger_SendEmail trigger
%>
<%
'start Trigger_SendEmail1 trigger
'remove this line if you want to edit the code by hand
Function Trigger_SendEmail1 (ByRef tNG)
Dim emailObj: Set emailObj = new tNG_Email
emailObj.Init tNG
emailObj.setFrom "{KT_defaultSender}"
emailObj.setTo "{email}"
emailObj.setCC ""
emailObj.setBCC "lee@firthcomputerservices.com.au"
emailObj.setSubject "Online Booking"
'FromFile method
emailObj.setContentFile "booking_guest.html"
emailObj.setEncoding "ISO-8859-1"
emailObj.setFormat "HTML/Text"
emailObj.setImportance "Normal"
Set Trigger_SendEmail1 = emailObj.Execute()
End Function
'end Trigger_SendEmail1 trigger
%>
<%
' Make an insert transaction instance
Dim ins_tblbookings: Set ins_tblbookings = new tNG_insert
ins_tblbookings.init MM_manbo_STRING
tNGs.addTransaction ins_tblbookings
' Register triggers
ins_tblbookings.registerTrigger Array("STARTER", "Trigger_Default_Starter", 1, "POST", "KT_Insert1")
ins_tblbookings.registerTrigger Array("BEFORE", "Trigger_Default_FormValidation", 10, formValidation)
ins_tblbookings.registerTrigger Array("END", "Trigger_Default_Redirect", 99, "thankyou.htm")
ins_tblbookings.registerTrigger Array("AFTER", "Trigger_SendEmail", 40)
ins_tblbookings.registerTrigger Array("AFTER", "Trigger_SendEmail1", 40)
' Add columns
ins_tblbookings.setTable "tblbookings"
ins_tblbookings.addColumn "first_name", "STRING_TYPE", "POST", "first_name", ""
ins_tblbookings.addColumn "last_name", "STRING_TYPE", "POST", "last_name", ""
ins_tblbookings.addColumn "email", "STRING_TYPE", "POST", "email", ""
ins_tblbookings.addColumn "phone", "STRING_TYPE", "POST", "phone", ""
ins_tblbookings.addColumn "booking_date", "DATE_TYPE", "POST", "booking_date", ""
ins_tblbookings.addColumn "booking_time", "STRING_TYPE", "POST", "booking_time", ""
ins_tblbookings.addColumn "guests", "NUMERIC_TYPE", "POST", "guests", ""
ins_tblbookings.addColumn "message", "STRING_TYPE", "POST", "message", ""
ins_tblbookings.addColumn "date_submit", "DATE_TYPE", "POST", "date_submit", "{now}"
ins_tblbookings.setPrimaryKey "bookingID", "NUMERIC_TYPE", "", ""
%>
<%
'Execute all the registered transactions
tNGs.executeTransactions
%>
<%
'Get the transaction recordset
Dim rstblbookings
Dim rstblbookings_numRows
Set rstblbookings = tNGs.getRecordset("tblbookings")
rstblbookings_numRows = 0
%>
Man Bo Restaurant - Make a Booking
<% Response.Write tNGs.displayValidationRules()%>