/ Forums / Advansys Formativ / Creating Solutions with Formativ / Getting data from HTML forms – newbie question

  • Creator
    Topic
  • #3951
    kparmelee
    Participant

    Hello all,

    I’m writing an applet that launches an HTML form then generates a GroupWise email containing the data in the form.

    I’ve gotten pretty far, however I can’t seem to get the data out of the form and into the email. I run the following code with no errors, however my data doesn’t appear in the new GroupWise mail:

    Sub Main(Client, GWEvent)

    Dim aDlg
    Set aDlg = Utilities.NewHTMLDialog
    aDlg.Caption = “New Account Request Form”
    aDlg.HTMLCode = Utilities.LoadStringFromFile(Utilities.GetDataDirectory & “test.htm”)
    aDlg.Execute
    FormVariables.ItemByName(“txtLastName”)
    Dim Msg
    GroupWise.NewMail
    Set Msg = GroupWise.ComposingItem
    if Msg is Nothing then
    MsgBox(“No composing item available”)
    else
    Msg.BodyText = txtLastName
    Set Msg = nothing
    end if
    End Sub

    And here is the HTML code behind test.htm:

    <html>

    <head>
    <meta http-equiv=”Content-Language” content=”en-us”>
    <meta http-equiv=”Content-Type” content=”text/html; charset=windows-1252″>
    <meta name=”GENERATOR” content=”Microsoft FrontPage 4.0″>
    <meta name=”ProgId” content=”FrontPage.Editor.Document”>
    <title>Last Name</title>
    </head>

    <body>

    <form method=”POST”>
    <p><input type=”Hidden” Name=”formativapplet” value=”Kates Applet.vbf”>Last Name: <input type=”text” name=”txtLastName” size=”20″></p>
    <p><INPUT TYPE=”SUBMIT” NAME=”MROK” VALUE=”OK”><input type=”reset” value=”Reset” name=”B2″></p>
    </form>

    </body>

    </html>

    I’m running GroupWise 6.5. What am I doing wrong?

    Thanks,
    Kate

  • Author
    Replies
  • #6691
    Support 1a
    Participant

    The FormVariables object only returns the values from Formativ Portals – not HTML dialogs. I think there may be an error in the documentation in this regard.

    You need to use the aDlg.Variables object, which is very similiar to the FormVariables object. We have updated your code to show how this works.

    Advansys Support

    Sub Main(Client, GWEvent)
     
      Dim aDlg 
      dim iHtmlCtl
      dim iLastName
     
      Set aDlg = Utilities.NewHTMLDialog 
      aDlg.Caption = "New Account Request Form" 
      aDlg.HTMLCode = Utilities.LoadStringFromFile(Utilities.GetDataDirectory & "test.htm")
      aDlg.Execute
      
      ' Returns variables and its values set by HTML form controls in the dialog
      set iHtmlCtl = aDlg.Variables.ItemByName("txtLastName")
      if not iHtmlCtl is nothing then
        iLastName = iHtmlCtl.Value
      end if  
      
      Dim Msg
      GroupWise.NewMail
      Set Msg = GroupWise.ComposingItem
     
      if Msg is Nothing then
        MsgBox("No composing item available")
      else
        Msg.BodyText = iLastName
        Set Msg = nothing
      end if
     
      
    End Sub
    
    #6690
    kparmelee
    Participant

    Thank you so much!

    Ultimately, I want this form to be pretty comprehensive – lots of text boxes, check boxes, and combo boxes.

    What’s the most effecient way to get all those variables out of the form and into the message? Or do I basically just start at the beginning and “dim” them all one by one?

    Thank you so much!
    Kate

    #6689
    Support 1a
    Participant

    Kate,

    You need to use the .ItemByName method to access each variable in a HTML form, so if that’s what you mean by ‘dim’ each one, then yes.

    Please let us know if you need any other assistance.

    Advansys Support

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.