Generating Data for JADE_TAG Tags Only

If you want to process only the JADE_TAG tags when HTML is generated for a page, set the JadeHTMLClass class generateHTMLForJadeTagsOnly property to true, in which case all other tags will not be altered in any way. The default for this property is false, which will process all tags. See also "JADE_TAG Tag Notes", earlier in this chapter.

The steps in the following example illustrate the behavior of HTML document processing when HTML is generated for JADE_TAG tags only.

  1. Use the HTML Wizard to import the following HTML.

    <html>
    <body>
    <jade_tag name="header">
    <form method="POST" action="http://localhost/jade/jadehttp.dll?S2">
    <input type=text name=textbox value="">
    <input type=submit name="submit" value="OK">
    </form>
    <jade_tag name="footer">
    </body>
    </html>
  2. The HTML Wizard is then displayed as is shown in the following image.

  3. Add the following JADE code in the updateValues method for the DocExample class.

    vars
    begin
        header := "This is the header";
        footer := "This is the footer";
        return inheritMethod();
    end;
  4. The following image shows the Web browser when this page is opened.

  5. Enter some data in the text box, as shown in the following image, and then click the OK button.

  6. The page is now processed by Web application framework and the text box has the value Fred Langley displayed in it.

  7. The Web application framework then calls the updateValues method again and generates the HTML for all tags including the <input type=text …> tag, which is sent back to the Web browser.

    Because the <input type=text …> is also processed, the generated HTML contains the value of the corresponding property for this tag.

    The Web browser is the same as that shown in step 5 of this example.

  8. Add a create method with the following code to the Test class.

    create() updating;
    begin
        generateHTMLForJadeTagsOnly := true;
    end;
  9. Repeat steps 4 through 7 of this example.

    The Web browser then looks like the following image.

    The text box is now empty instead of having the text Fred Langley displayed in it, because now only the JADE_TAG tags are processed so the <input type=text …> tag takes on its default value (which in this case is "", as can be seen in the HTML shown in step 1 of this example).

  10. One way to make this simple HTML work as before but still processing only <jade_tag> tags is to alter the HTML, as follows.

    <html>
    <body>
    <jade_tag name="header">
    <form method="POST" action="http://localhost/jade/jadehttp.dll?S2">
    <input type=text name=textbox value="<jade_tag name=textBoxValue>">
    <input type=submit name="submit" value="OK">
    </form>
    <jade_tag name="footer">
    </body>
    </html>

    In this HTML, another <jade_tag> to represent the value of the text box has been added. Saving this text adds another String property textBoxValue, to represent the JADE_TAG tag.

  11. Change the updateValues method to populate the textBoxValue with the value of textbox, as shown in the following method.

    updateValues(): Boolean updating;
    vars
    begin
        header := "This is the header";
        footer := "This is the footer";
        textBoxValue := textbox;
        return inheritMethod();
    end;
  12. Running the application now has the same behavior as before the generateHTMLForJadeTagsOnly property was set to true, while generating HTML only for the JADE_TAG tags.

In general, any tag that is input-output is populated only with its initial value when the HTML message is generated, regardless of whether these values are in the message or changed in code. You therefore need to consider an approach like the one shown in this example if you need this information to be sent back to the Web browser.