Forums

Table with form elements and data

Gugo 05 Jan, 2017
Hello
Is the idea to make the table, as shown below.
[attachment=0]Table.jpg[/attachment]

How can this be implemented? To read out the data from a specific table in the database and displayed in a table.
But also to add any control elements (eg checkbox) and are consistent with the data in row.

Perhaps this is done with the help of Columns. But I think that I'm moving in the wrong direction.
[attachment=1]Table2.jpg[/attachment]

Please help solve the problem ...
Gugo 05 Jan, 2017
On a tab of design have added the field and have placed a code there

<table border="1" bordercolor="#000">
  <?php for ($i = 1; $i <= 10; $i++) {?>
  <tr>
    <td><div class="form-group gcore-form-row" id="form-row-checkbox3">
        <label for="checkbox<?php echo $i;?>" class="control-label gcore-label-left gcore-label-checkbox">Label <?php echo $i;?></label>
        <div class="gcore-input gcore-display-table" id="fin-checkbox<?php echo $i;?>">
          <input name="checkbox<?php echo $i;?>" id="checkbox<?php echo $i;?>" value="1" class="A" title="" style="" data-load-state="" data-tooltip="" type="checkbox" />
        </div>
      </div></td>
    <td><?php echo $i;?></td>
    <td><?php echo $i;?></td>
  </tr>
  <?php }?>
</table>

It was necessary to attach to data. It is necessary to understand still how to make compliance to every line.
That it was possible to define what of checkboxes it is clicked. It is possible to eat more correct realization, than mine?
I apologize for English. I use the translator.
Gugo 05 Jan, 2017
Sorry. On a tab of design have added the *Custom code* and have placed a code there
Gugo 06 Jan, 2017
Answer
In a tab of design has added a Custom code and the Submit button.
[attachment=0]01.jpg[/attachment]
The Custom code has such contents:

<table border="1" bordercolor="#000">
  <tr>
    <td><p>Select</p></td>
    <td><p>Name</p></td>
    <td><p>ID</p></td>
  </tr>
  <?php
foreach ($form->data[DataSS] as $key => $value) {
	?>
  <tr>
    <td><label for="checkbox<?php echo $key;?>" class="control-label gcore-label-left gcore-label-checkbox">Take <?php echo $key+1;?></label>
      <input name="checkbox<?php echo $key;?>" id="checkbox<?php echo $key;?>" value="<?php echo $value[id];?>" class="A" type="checkbox" /></td>
    <td><?php echo $value[name];?></td>
    <td><?php echo $value[id];?></td>
  </tr>
  <?php }?>
</table>


In a tab Setup, loading events, before (Render form) has added the DBread.
In the Submit event has added DBread. A after also Custom code too.
[attachment=1]02.jpg[/attachment]
In both readers the table of users (#__users) is chosen. Multi reading is also established.
Model ID is DataSS. List of fields is name, id.
The Custom code contains it:

<table border="1" bordercolor="#000">
  <tr>
    <td><p>Select</p></td>
    <td><p>Name</p></td>
    <td><p>ID</p></td>
  </tr>
  <?php
foreach ($form->data[DataSS] as $key => $value) {
	if ($form->data[checkbox.$key]==$value[id]){
	?>
  <tr>
    <td><?php echo Selected;?></td>
    <td><?php echo $value[name];?></td>
    <td><?php echo $value[id];?></td>
  </tr>
  <?php }
  }?>
</table>

If to whom it is interesting, then can improve and use everything in the needs.
Thanks to myself, could understand.
GreyHead 06 Jan, 2017
Hi Gugo,

Sounds as though you have this solved. You can also use ChronoConnectivity for displaying list like this from tables if you need something more complex than a simple table.

Bob
This topic is locked and no more replies can be posted.