Sub btnsubmit_clicked(target As String)
Dim email As ABMInput = page.Component("inp5")
If email.Text = "" Then
Toast("Email Address can not be empty!",5000)
Return
End If
page.Pause
Dim comp As ABMInput = page.Component("inp1")
Dim titl As ABMInput = page.Component("inp2")
Dim last As ABMInput = page.Component("inp4")
Dim phone As ABMInput = page.Component("inp6")
Dim loc As ABMInput = page.Component("inp7")
Dim usr As ABMInput = page.Component("inp9")
Dim pss As ABMInput = page.Component("inp10")
' this becomes the registration code - the current datetime number (do whatever you want)
Dim dat As Long = DateTime.Now
Dim contmap As Map
contmap.Initialize
contmap.Put("comp", comp.Text)
contmap.Put("email", email.Text)
contmap.Put("loc", loc.Text)
contmap.Put("last", last.Text)
contmap.Put("usr", usr.Text)
contmap.Put("phone", phone.Text)
contmap.Put("pss", pss.Text)
contmap.Put("title", titl.Text)
contmap.Put("dat", dat)
Dim SQL As SQL = DBM.GetSQL
Dim vars As List
vars.Initialize
vars.Add(email.Text)
vars.Add(comp.Text)
Dim eml As List = DBM.SQLSelect(SQL, "SELECT * FROM member WHERE email = ? and company = ?", vars)
If eml.Size > 0 Then
DBM.CloseSQL(SQL)
page.Msgbox("ERR","","Email Address and Municipality Name Already Exist!"&CRLF&"Only ONE Subcription Per Subscriber Is Allowed! ","OK",False,ABM.MSGBOX_POS_CENTER_CENTER,"")
' email.Text = ""
email.Refresh
page.Resume
Return
End If
Toast("Waiting for email server response...",7000)
SQL.ExecNonQuery2("INSERT INTO member (company, title,first,last,location,email,phone,comment,date,notes,username,pass) VALUES(?, ?, ?, ?, ?, ?, ?, ?,?,?,?,?)", Array As Object(comp.text,titl.text,"",last.Text,loc.Text,email.Text,phone.Text,"",dat,"0",usr.text,pss.text ))
DBM.CloseSQL(SQL)
Example of email received by user...
[CODE=b4x]
Welcome to Municipal Management System !
Your FIRST login will require THIS Registration Number to confirm your subscription!
Registration Number (copy and paste it): 1586649887677
Your Administrator Login is:
User Name: margs
Password: marg11
OTHER FORM DATA:
Municipality: - RM of Estevan
Full Name: - Marg Stevees
Title: - Admin
Email: - the_email_address@gmail.com
Phone #: - 234
Mailing Address:
123 Main Street
Estevan, SK
N7N 1V1
Thank you for Subscribing to Municipal Management System.
Created By: Modern Mobile Solutions LLC.