Categories > TinyButStrong general >

select and MergeBlock in a Table

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Peter
Date: 2007-10-10
Time: 14:39

select and MergeBlock in a Table

Hello,
i am trying to display an table with checkboxes(selects) for each row and can't get it merged. How can i then distinguish between the rows after the form is send?

Thanks Peter

HTML Code:
<tr>
  <td>[site_list.bezeichnung;block=tr]</td>
  <td>[site_list.comments;ope=html;select=anz_comments] 
    <input type="radio" name="anz_comments" value="1">
    Ja
    <input type="radio" name="anz_comments" value="0">
    Nein </td>
</tr>

PHP Code:

$TBS->LoadTemplate( 'comments.html');
$TBS->MergeBlock('site_list', $comments->get_sites());
$TBS->MergeField('onshow');
echo $TBS->Source;
By: TomH
Date: 2007-10-10
Time: 15:13

Re: select and MergeBlock in a Table

First of all... your example indicates radio boxes of the same name so there is no difficulty as only one can be selected.

Assuming you really meant to indicate checkboxes... then you just indicate them as php array elements like so "name=anz_comments[]''
<td>[site_list.comments;ope=html;select=anz_comments]
    <input type="checkbox" name="anz_comments[]" value="1">
    Ja
    <input type="checkbox" name="anz_comments[]" value="0">
    Nein </td>

Hope that helps,
TomH
By: Peter
Date: 2007-10-10
Time: 15:17

Re: select and MergeBlock in a Table

no i meant radio boxes. the difficulti is that i have many table rows with radio boxes and TBS merges this select not :(
By: TomH
Date: 2007-10-10
Time: 16:38

Re: select and MergeBlock in a Table

Okay....
(1) assure that the data in $comments->get_sites() is structured correctly
(2) then try this (only because I don't understand why you are choosing to do it as you've shown)
include_once('tbs_class.php');
$TBS = new clsTinyButStrong ;
$TBS->LoadTemplate( 'comments.html');
$TBS->MergeBlock('site_list', $comments->get_sites());
$TBS->Show();
By: Peter
Date: 2007-10-12
Time: 11:55

Re: select and MergeBlock in a Table

no it does not work all get merged but not the radio selects
By: Peter
Date: 2007-10-12
Time: 11:58

Re: select and MergeBlock in a Table

Here is the structure of the array


    [0] => Array
        (
            [id_internet] => 480
            [comments] => 1
            [bezeichnung] => site1
            [anzahl] => 0
        )

    [1] => Array
        (
            [id_internet] => 501
            [comments] => 0
            [bezeichnung] => site2
            [anzahl] => 0
        )