0

I am trying to get conditional display to work properly. What I am attempting to do is:

Within a block that has been merged, if a value is empty I want to display an input box along with a few other hidden variables I need to carry along with it, but if the value is not empty I wish to simply display that value.

PHP

$cks . . some query;
$TBS->LoadTemplate("check.html") ;
$TBS->MergeBlock("cks",$cks);
$TBS->Show(TBS_NOTHING); echo($TBS->Source);

Template portion

<td width="25%" class="mod_row2">[cks.check1]</td>
<td width="25%" class="mod_row2">
[cks.value;ifempty=
<input type="text" name="value[]" value="" size="26">
<input type=hidden name="check_id[]" value="[cks.check_id]">
<input type=hidden name="equip_id[]" value="[cks.equip_id]">
]</td> "

Everything works except the values of the hidden cells are not merged. I don't know if this is the right way to do this or if this is possible . . . TBS 3.8.0, php 5.3.3

Thanks

Peter

Peter
  • 3
  • 1

1 Answers1

0

Your HTML part with <input> is not parsed because it is embedded in a TBS parameter (ifempty).

It is not a good practice to embed HTML/XML in the TBS fields.

The best way is to use conditional display with block. The magnet feature is nice for that. Example for you :

<td width="25%" class="mod_row2">[cks.check1]</td>
<td width="25%" class="mod_row2">
    <div>
        [cks.value;ope=mok:;magnet=div]
        <input type="text" name="value[]" value="" size="26">
        <input type=hidden name="check_id[]" value="[cks.check_id]">
        <input type=hidden name="equip_id[]" value="[cks.equip_id]">
    </div>
</td>

In this example, the parameter ope=mok: means that the block is displayed if the value is empty string (''), and is deleted in other cases.

Skrol29
  • 5,402
  • 1
  • 20
  • 25
  • Thanks - I read the ope section a few times, but I was having trouble figuring how to make it work with the empty cell. I didn't realize that leaving mok: empty would satisfy the condition. – Peter Jun 20 '18 at 21:20