Hello,
I have the following scenario: I have an HTML template (from another developer—not TMS Web Core) that contains various content, and I would now like to insert a TMS Web Core TWebDBGrid into an existing div tag with a unique ID. The other developer can make adjustments if necessary (e.g., loading my TMS Web Core JS app, starting it with rtl.run(), etc.). I’ve included an example where demo.html represents the developer's template, and I’d like to insert the grid into the "appcontent" div tag. I created a simple TMS Web Core application for this, I set the FormContainer on the form to "appcontent," and added the following body in demo.html:
<body>
<div>
<div class="row g-0 py-2">
<div class="col-8">
<span class="text-mode">Subtotal demo.html</span>
</div>
<div class="col-4 text-end">
<span class="ml-auto">$89.00</span>
</div>
</div>
</div>
<!-- I want to insert the form with the grid here -->
<div id="appcontent" class="appcontent">
</div>
<div>
<a class="btn" href="#">Continue to Checkout in demo.html</a>
</div>
<script src="WebshopSales.js"></script>
<script type="text/javascript">
var CONTAINERID = "appcontent";
rtl.run();
</script>
</body>
The HTML file of the form looks like this:
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>TMS Web Project</title>
<style>
</style>
</head>
<body>
<div>
<div class="row g-0 py-2">
<div class="col-8">
<span class="text-mode">Subtotal uWebShopSales.html</span>
</div>
<div class="col-4 text-end">
<span class="ml-auto">$89.00</span>
</div>
</div>
</div>
<!-- If the id of this div is "appcontent", then the Form with the Grid is always inserted here and not in the demo.html! -->
<!-- If I remove this div, then the Form with the grid is inserted directly before the </body> end tag -->
<div id="appcontent" class="appcontent">
</div>
<div>
<a class="btn" href="#">Continue to Checkout in uWebshopSales.html</a>
</div>
</body>
</html>
When I run everything, the form with the grid is generated, but it is never inserted into the appcontent
div of demo.html
. Instead, the body of demo.html
is always replaced with the body of the HTML from the TMS Web Core form (uWebshopSales.html
) and rendered within the appcontent
div of uWebshopSales.html. However, that’s not what I want to achieve. The content of demo.html
must not be overwritten in any way; I am only allowed to insert content into the one div tag with the ID appcontent
. You can see when you refresh the page, that first the demo.html can be seen, but is directly replaced by the html of the form.
What can I do to get this to work?
Here are my files (my tms webserver is running on port 8005, you have to change this if needed).
demo.html (928 Bytes)
shop_websales.html (760 Bytes)
uWebshopSales.dfm (2.6 KB)
uWebshopSales.html (922 Bytes)
uWebshopSales.pas (925 Bytes)
WebshopSales.dpr (290 Bytes)
WebshopSales.dproj (62.5 KB)