/ Forums / Advansys Formativ / Creating Solutions with Formativ / Not A Programmer Question – Interpret HTMLDialog

  • Creator
    Topic
  • #3893
    gritz
    Participant

      I want to experiment with my own HTML forms. Using the Language and Programming guides, and not being a programmer, I got very confused on creating an HTML dialog. Using the code example from “Creating HTML Dialogs”, I successfully created an applet that does nothing, but works well. When I add the HTML code to the line aDlg.HTMLCode = <supply HTML code here>
      I substituted some simple HTML..ie <html><body>test</body></html>
      and I get a syntax error at the start of the code. If I substitute a string , “test”, it works fine. If I put the entire html string in quotes, that seems to work also, but how do I pass more than one line of HTML at a time? I also tried creating an applet using the “Display existing data in an HTML dialog” and passing a local HTML file in (I thought)…again, the applet runs, but nothing inside.Just an embedded box, with a close and cancel at the top. As this is newbie stuff, if you can point me to an example of a working HTML applet/dialog, I would greatly appreciate it!
      Greg

    • Author
      Replies
    • #6535
      Support 1a
      Participant

        Here is a very simple example of a HTML dialog. Create a new applet, then copy and paste this source code.

        Please let me know if you require any further information.

        Advansys Support

        '-------------------------------------------------------------------------------
        ' Insert your comments here
        '-------------------------------------------------------------------------------
        
        Sub Main(Client, GWEvent)
        
          Set aDlg = Utilities.NewHTMLDialog 
          aDlg.ToolbarVisible = FALSE
          aDlg.Caption = "HTML dialog" 
          aDlg.HTMLCode = "<HTML> " &_
                          "  <HEAD> " &_
                          "  <TITLE></TITLE> " &_
                          "  </HEAD> " &_
                          "  <BODY>" &_
                          "  <FORM METHOD=""POST""> " &_
                          "  <TABLE BORDER=""0"" WIDTH=""100%""> " &_
                          "    <TR> " &_
                          "    <TD> Dialog Heading</TD> " &_
                          "    </TR> " &_
                          "    <TR> " &_
                          "    <TD HEIGHT=""50pt""> Body text</TD> " &_
                          "    </TR> " &_
                          "    <TR> " &_
                          "    <TD ALIGN=""RIGHT""><INPUT TYPE=""SUBMIT"" NAME=""MRCANCEL""" &_
                          "    VALUE=""Cancel"">   <INPUT TYPE=""SUBMIT"" NAME=""MROK""" &_
                          "    VALUE=""OK""> </TD> " &_
                          "    </TR> " &_
                          "  </TABLE> </FORM> </BODY>" &_
                          "</HTML>"
          aDlg.Execute 
        
        End Sub
        #6537
        gritz
        Participant

          Thanks so much..I was on the right track but getting frustrated..as to my second question, can you pass an HTML page in a different loction to the dialog, using aDlg.HTMLCode = Utilities.LoadStringFromFile(Utilities.GetDataDirectory & “HTML Dialog.htm”)?Could not get that to work either and I thought that was the other part of what I was reading. Obviously makes it simpler, to design your form(s) etc, externally and then reference and use them from within the applet.
          Thanks again! Greg

          #6536
          gritz
          Participant

            Found part of my error…the line aDlg.HTMLCode = Utilities.LoadStringFromFile(Utilities.GetDataDirectory & “c:/website/formativdlg.html”)works when I remove the Utilities.GetDataDirectory and reference my file only…aDlg.HTMLCode = Utilities.LoadStringFromFile(“c:/website/formativdlg.html”)
            That works well…again my lack of programming knowledge…I assume if the file was in the “C:Program FilesAdvansysFormativData” directory it would work…things are looking up!

            #6534
            Support 2
            Moderator

              Good news. And yes, you’re right, the resultant path would be incorrect when adding the GetDataDirectory to the fully qualified path to your file.

              Regards,

              Advansys Support

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