Categories > TinyButStrong general >

"selected" doesn't work on sub-option-blocks?

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: D. Klinksiek
Date: 2005-12-20
Time: 12:42

"selected" doesn't work on sub-option-blocks?

Hi,

i have a big problem with sub-option-blocks, selected doesn't work as expected.
I changed one of your examples to show it:

test.html
<body>
<p align="center" class="title-page">&nbsp;</p>
<br>
<table width="400" border="1" align="center" cellpadding="4" cellspacing="0" bordercolor="#3399CC">
  <tr>
    <td><strong>Team:</strong> [mb.team;block=tr]<br>
    <br>
      <br>
      <table border="1" align="center" cellpadding="2" cellspacing="0">
        <tr bgcolor="#CACACA">
          <td width="330">     <select name="TEST[]" size="1"  >
             <option value="[sb.score;block=option;p1=[mb.$]]">[sb.town]</option>
            <option value="">[mb.score;selected]</option>
           </select></td>
        </tr>
      </table>
  </td>
  </tr>
</table>
</body>

test.php
include_once('include/tbs_class.php') ;

$TeamList[0] = array('team'=>'Eagle'  ,'score'=>'253');
$TeamList[0]['matches'][] = array('town'=>'London','score'=>'253','date'=>'1999-11-30');
$TeamList[0]['matches'][] = array('town'=>'Paris' ,'score'=>'145','date'=>'2002-07-24');

$TeamList[1] = array('team'=>'Goonies','score'=>'281');
$TeamList[1]['matches'][] = array('town'=>'New-York','score'=>'365','date'=>'2001-12-25');
$TeamList[1]['matches'][] = array('town'=>'Madrid'  ,'score'=>'521','date'=>'2004-01-14');

$TeamList[2] = array('team'=>'MIB'    ,'score'=>'615');
$TeamList[2]['matches'][] = array('town'=>'Dallas'    ,'score'=>'362','date'=>'2001-01-02');
$TeamList[2]['matches'][] = array('town'=>'Lyon'      ,'score'=>'321','date'=>'2002-11-17');
$TeamList[2]['matches'][] = array('town'=>'Washington','score'=>'245','date'=>'2003-08-24');

$TBS = new clsTinyButStrong ;
$TBS->LoadTemplate('test.html') ;

$Nbr = $TBS->MergeBlock('mb','array','TeamList') ;
if ($Nbr>0) $TBS->MergeBlock('sb','array','TeamList[%p1%][matches]') ;

$TBS->Show() ;

Do i miss something or is this an error?

Thank you and greetings

Dirk
By: D. Klinksiek
Date: 2005-12-20
Time: 13:16

Re: "selected" doesn't work on sub-option-blocks?

HI,

i forgot to mention:

The fist select box should show "London" in this example..

Greetings

Dirk
By: Skrol29
Date: 2005-12-20
Time: 13:50

Re: "selected" doesn't work on sub-option-blocks?

Hello,

Unfortunately, this cannot logically work. I agree you have to merge block "mb" first and then block "sb" because "sb" is a subblock. But doing so, the TBS tag [mb.score;selected] cannot found the asked value in the <select> listbox because they are simply not yet existing. This listbox is populated after, when "sb" is merged.

You can try to replace [mb.score;selected] by an [onshow] tag.
Something like :
[onshow;ifempty=[mb.score];selected]
This can work because [onshow] Fields are always merged with an empty value.
By: D. Klinksiek
Date: 2005-12-20
Time: 16:02

Re: "selected" doesn't work on sub-option-blocks?

Ok,

thanks a lot, that helped!
Very good support here!

Greetings

Dirk