Hi
I have a HTML page that has 2 variations of a form on the same page. When the page is loaded, one variation of the form is shown via visibility="visible" & the other variation is set to hidden using visibility="hidden".
Each of these form variations has a select box that I am populating using TBS (see HTML snippet below). This select box is used in each variation, and I want it to have the same option content in each variation. As you'll see, I am using the same setup, i.e.
<option value="[categories.categoryID]">[categories.category;block=option]</option>
in each form variation in the HTML.
<div id="simple" style="visibility:visible;z-index:1;">
<form action="add_new_menuitem.php" method="post" name="simple">
<table width="200" border="0" cellspacing="2" cellpadding="0">
<tr>
<td>category:</td>
<td>
<select name="categoryid" size="1">
<option value="[categories.categoryID]">[categories.category;block=option]</option>
</select>
</td>
</tr>
.... stuff deleted ....
</table>
</form>
</div>
<div id="advanced" style="position:relative;top:-175;visibility:hidden;">
<form action="add_new_menuitem.php" method="post" name="advanced">
<table width="200" border="0" cellspacing="2" cellpadding="0">
<tr>
<td>category:</td>
<td>
<select name="categoryid" size="1">
<option value="[categories.categoryID]">[categories.category;block=option]</option>
</select>
</td>
</tr>
.... stuff deleted ....
</table>
</form>
</div>
|
This is what I have in the PHP part:
.. db stuff delete
$TBS = new clsTinyButStrong;
$TBS->LoadTemplate('setup_menuitems.htm');
$TBS->MergeBlock('categories', $connection_id, $categories_qry);
$TBS->MergeBlock('menuitem', $connection_id, $menuitems_qry);
mysql_close($connection_id);
$TBS->Show() ;
|
However I see I get a very strange result when the HTML page is merged & displayed. I found out it is to do with the way I currently setup the template for select in both variations of the form. If I remove the selects, the problem goes away of course.
I found out that the workaround is to create 2 separate mergeblocks like follows & update the HTML template accordingly, however I think that is not efficient since the same query will be called twice.
$TBS->MergeBlock('categories1', $connection_id, $categories_qry);
$TBS->MergeBlock('categories2', $connection_id, $categories_qry);
$TBS->Show() ;
|
Is there a better way that I can setup the HTML template to avoid this workaround?
Thanks
Regards
Michael.