Inserting a Web core application in a web page

Developing a web application using the combination of Delphi and TMS Web Core is by far the best way to go. I am now developing data entry forms appearing in a web site. As web sites are developed using different tools, each having their specific conventions and restrictions, I wanted to include a web core application while keeping the impact on the web page structure to a minimum.

I thought the easiest way to do that was using an iframe. And in fact, it is, as long as the input forms have a fixed height. However, when forms are more dynamic or when they have to be part of responsive web pages, there must be a way to calculate the required height of the iframe. This is where I got lost.

I have developed a small form to illustrate. The form is 270pixels high. So, I defined the iframe height as "270px" and the form appears correctly. However, when clicking the checkmark of the form, the web core application reduces the form height by 45pixels and this should be reflected by adjusting the iframe height, so that the text following the iframe moves up as well. I don't know how I can do that, especially because the web core application is itself very dynamic and so there is no attribute giving me the required height to pass to the iframe.

Attached you can find a zip file containing the Web core application (TestForm) and the file "WebPage.html", which is a small web page containing the iframe to include the web core application.

Note that the web core application is only a small example. The forms I want to develop have several sections and paragraphs, each of which could get hidden, depending on the user input. So, the height of forms may frequently change during the data input actions. (779.8 KB)


The IFRAME height is handled from welcomepage.html and this IFRAME is unaware of what is displayed inside itself. Therefore, it won't adapt its size when the content of what is in the IFRAME changes.
If you want to keep using an IFRAME, I'm not sure how the web app could access properties of the IFRAME in which it is hosted. This would require cross domain access and I could not find evidence this is possible.
If you want to use a template somehowe, we recommend to use this directly in the application HTML file (as is done in all of our demos) and use the Form.FormContainer to specify the DIV element in the template where to display the form.