|
-
A simple registration form
Need a user registration form for my 2007 RFID World project and a quick look around found several MyInput and SilentCmdText examples and probably all I need. The following program is only 40 lines and it provides a good looking from for title select, input, validation for phone and email address and upon submits, it’ll add the record to the database and display a message. The entire process takes about 30 minutes. The program is divided into 2 parts separated by ASPdbPostBack. Once the submit button is clicked, it is then a Postback and part 2 will execute and save the record to the DB.
In the process, I updated the email reg exp to cover the latest addion url names like .name, .info etc. Watch out for the next release for that.
------------------------------------------------------
<script language="VB" runat="server">
Sub Page_Load(Src As Object, E As EventArgs)
Dim Mi As New Tornado.z
Dim db As String = Server.MapPath("/tornado/GD/RFIDWorld.mdb")
Mi.dbQP = "U=1|S=Airgate|th=tit=2007 RFID World Complementary Pass Request Form"
Mi.dbValidatorParams = "code=/tornado/Jars|entry=false"
Dim inp As String = "(;~)"
inp &= "Fi=Title| Ty=SelectBox| Val={{Mr.,Mrs.,Ms.,Dr.}}~"
inp &= "Fi=Name| type= TEXT| Tag=SIZE=50~"
inp &= "Fi=Company| type=TEXT| Tag=SIZE=50~"
inp &= "Fi=Position| type=TEXT| Tag=SIZE=50~"
inp &= "Fi=Phone| type=TEXT| Tag=SIZE=50|mask=USPHONE|event=both|req=true|err=I nvalid phone e.g. XXX-XXX-XXXX~"
inp &= "Fi=email| type=TEXT| Tag=SIZE=50|mask=EMAIL|event=both|req=true|err=Inv alid email address~"
inp &= "Fi=Application| type=TEXTAREA| Tag=COLS=50 ROWS=15 WRAP=True| Def=Airgate will pay for the $99 fee if we can provide a solution for your authentication problem. Please describe your product authentication problem here. If you are qualified, we'll send you the code to get your pass at the registration booth."
Mi.dbMyInputFlds = inp
Response.Write("<Center>" & Mi.ASPdbMyInputForm() & "</Center>")
If Mi.ASPdbPostBack Then
Dim log As String = CStr(Now())
Dim _title As String = Request.Form("Title").ToString
Dim _name As String = Request.Form("name").ToString
Dim _company As String = Request.Form("Company").ToString
Dim _position As String = Request.Form("Position").ToString
Dim _phone As String = Request.Form("Phone").ToString
Dim _email As String = Request.Form("Email").ToString
Dim _application As String = Request.Form("Application").ToString.Replace("'", "''")
Mi.dbQP = "u=1|Q=TB1|BM=TB1;0|Nh=t|D=" & db
Mi.dbDebug = "EditAction"
Dim val As String = "('" & _title & "','" & _name & "','" & _company & "','" & _position & "','" & _phone & "','" & _email & "','" & _application & "'," & "#" & log & "#)"
Mi.dbSilentCmdText = "com=INSERT INTO TB1 (tit,nam,company,pos,phone,email,application,tlog) VALUES " & val
If Mi.ASPdbExecuteCmd() > 0 Then
Response.Write("<h1>Thank you for your interest in Airgate Technologies<BR>We'll get back to you</h1>")
Else
Response.Write("<h1>Error in adding record to database</h1>")
End If
End If
End Sub
</script>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|