Tornado API Library - V12.30.08

z.ASPdbMyInputForm Method 

Produce Input FORM according to dbMyInputFlds.

Product Version

Gold
[Visual Basic]
Public Function ASPdbMyInputForm() As String
[C#]
public string ASPdbMyInputForm();

Return Value

Complete HTML code of Input Form.

Remarks

This examples are simple but accomplish a lot. See dbMyInputFlds for more examples.

Example

<script language="VB" runat="server">
Sub Page_Load(Src As Object, E As EventArgs)
  Dim pop As String = "<A HREF='#' onclick=""window.open('/tornado/templates/Filter-instructions.htm'," _
      & "'window_name', 'width=330, height=300, left=200, top=200, directories=no,menubar=no," _
      & "toolbar=no,status=no')"">Hello Click Me</A>"
  Dim Mi As New Tornado.z
  With Mi
      .dbDebug = "Request"
      .dbQP = "U=1|S=aspdb|th=tit=My Input Form #4"
      Dim Inp As String = "(;~)Fi=One|Ty=RONOSEND|Def=Do Not Send Me~ "
      Inp &= "Fi=Two| Ty=ROSEND|Def=Send Me~ "
      Inp &= "Fi=Three| Ty=RONOSEND|Def=" & pop & "~ "
      Inp &= "Fi=Four| Ty=textcalendar~ "
      Inp &= "Fi=Five| Ty=CheckBox~ "
      Inp &= "Fi=Six| Ty=SelectBox| Val={{One,Three,Five,Seven}}| Tex={{1-7-2}}~ "
      Inp &= "Fi=Seven| Ty=RADIO| Val={{2003-2006}}~ "
      Inp &= "Fi=Eight| Ty=HIDDEN| Def=I am a hidden field~"
      Inp &= "Fi=Nine| Ty=TextArea| Tag=cols=25 rows=5 "
      .dbMyInputFlds = Inp
      Response.Write(.ASPdbMyInputForm())
  End With
End Sub
</script>
Complete code for a registration form
 <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=Invalid Phone e.g. XXX-XXX-XXXX~"
    inp &= "Fi=email| type=TEXT| Tag=SIZE=50|mask=EMAIL|event=both|req=true|err=Invalid email address~"
    inp &= "Fi=Application| type=TEXTAREA| Tag=COLS=50 ROWS=15 WRAP=True| Def=Default Text."
    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
       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>

See Also

z Class | Tornado Namespace | dbMyInputFlds | dbEditUpdateFlds | Special Topic - Edit