Form/Table Data to Custom HTML Form

What I’m trying to do: I have pleading paper, similar to the above image, that will have static vertical lines and line numbers as shown, with dynamic content in the body of the page(s). I want to create a custom HTML Form that will hold the static HTML from the paper above, then make a parent/child Form with input fields that will display the dynamic content on the static HTML Form.

What I’ve tried and what’s not working: I made the custom HTML Form, and just realized I don’t know the best way to display the Form/Table data in the body of the custom HTML Form. I was trying to avoid having to use the html/slots approach, if possible.

The code below is a basic example of how I accomplish this in another program - curious to know if I can accomplish something similar within Anvil - call/fetch Table data within the custom HTML Form and hold within a variable/function/etc., then insert the data into the HTML code for output.

Code Sample:

<html escape>
    fetch_data_variable = data.from.this.table.row
<html escape end>
<html>
    <body>
        <div>Here is a custom HTML template</div>
        <div>my name is <%fetch_table_variable%></div>
    </body>
</html>

Output = Here is a custom HTML template
         my name is Adam

In a custom HTML form, you can use self.html to set the HTML used by the form. That HTML is just a string, so you can include whatever dynamic content you want in it.

If you need actual UI widgets mixed in, that’s different. For that you could look at the Rich Text component, since it allows specifying content in a subset of HTML and you can insert drop zones in the content. I don’t know if the subset of HTML allowed by Rich Text would be sufficient for what you’re doing.

If the Rich Text subset isn’t enough, and you want UI widgets mixed in, you’re back to HTML based drop zones.

3 Likes

@jshaffstall right on, I think the first option will work using self.html. Much appreciated!