/ Forums / Advansys Formativ / Creating Solutions with Formativ / HTML Dialog – Reading variables

  • Creator
    Topic
  • #4028
    rfaude
    Participant

    Hi,

    i want to read the contents of the variables from a html-form. But i cannot access them.



    '
    ' Insert your comments here
    '

    ' --- Define global variables ---
    Dim aDlg
    Dim sHTML
    dim iHTMLButton

    '

    Sub Main(Client, GWEvent)

    ShowTaskForm

    End Sub



    '

    Sub ShowTaskForm

    Dim sHTML

    Set aDlg = Utilities.NewHTMLDialog
    aDlg.Caption = "Mail System Check Version 0.0.1 © R.Faude"
    aDlg.Borderstyle = fbsDialog
    aDlg.Width = 320
    aDlg.Height = 200
    aDlg.ToolbarVisible = FALSE

    sHTML = "<html>"

    ' --- define CSS ---
    sHTML = sHTML & "<style type=""text/css"">"
    sHTML = sHTML & "td {font-family:arial, verdana, helvetica, sans-serif; color:black; font-size:12px;}"
    sHTML = sHTML & "</style>"
    sHTML = sHTML & "<body>"

    ' --- create Form ---
    sHTML = sHTML & "<form method=""post"">"
    sHTML = sHTML & "<table border=""1"">"
    sHTML = sHTML & "<tr>"
    sHTML = sHTML & " <td style=""background-color: #96D1FF; text-align:right; width:90px"">Number of Mails</td>"
    sHTML = sHTML & " <td><input name=""number"" type=""text"" size=""3"" maxlength=""3"" style=""text-align:center""></td></td>"
    sHTML = sHTML & "</tr>"
    sHTML = sHTML & "<tr>"
    sHTML = sHTML & " <td style=""background-color: #96D1FF; text-align:right; vertical-align:top; width:90px"">Destination</td>"
    sHTML = sHTML & " <td><input type=""checkbox"" name=""destination"" value=""mail-loop"">Mail-Loop"
    sHTML = sHTML & " <br><input type=""checkbox"" name=""destination"" value=""echo-tu"">echo@tu-berlin.de</td>"
    sHTML = sHTML & "</tr>"
    sHTML = sHTML & " <td style=""height:10px""></td>"
    sHTML = sHTML & "<tr>"
    sHTML = sHTML & "</tr>"
    sHTML = sHTML & "</table>"
    sHTML = sHTML & "<table border=""1"">"
    sHTML = sHTML & "<tr><td><input type=""submit"" name=""MROK"" value=""Send""> <input type=""submit"" name=""MRCANCEL"" value=""Cancel""</td></tr>"
    sHTML = sHTML & "</table>"
    sHTML = sHTML & "</form>"

    sHTML = sHTML & "</body></html>"

    aDlg.HTMLCode = sHTML
    iHTMLButton = aDlg.Execute

    ' --- Free up memory ---
    set aDlg = nothing

    if (iHTMLButton = 1) then
    msgbox FormVariables.Count
    Set iNumberCTL = FormVariables.ItemByName("number")
    if not iNumberCTL is nothing then
    call msgbox(iNumberCTL.value, vbInformation, "Number")
    end if
    else
    ' msgbox "Cancel"
    end if


    End Sub

    '

    What i am doing wrong?

    Thanks ….

    Ralf

  • Author
    Replies
  • #6893
    Support 1
    Participant

    You cannot use the FormVariables collection with an HTML Dialog. FormVariables is associated with a form posted from a Formativ Portal. Rather, you should use the Variables property of the HTMLDialog object, as shown in the following revision to your code.

       if (iHTMLButton = 1) then
          msgbox aDlg.Variables.Count
          Set iNumberCTL = aDlg.Variables.ItemByName("number")
          if not iNumberCTL is nothing then
             call msgbox(iNumberCTL.value, vbInformation, "Number")
          end if
       else
         ' msgbox "Cancel"
       end if
    
       ' --- Free up memory ---
       set aDlg = nothing
    

    Advansys Support

    #6891
    rfaude
    Participant

    Great!

    Thanks.

    Ralf

    #6892
    Support 1
    Participant

    I am glad to hear this works for you.

    Advansys Support

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