Forum for discussing general topics related to Couch.
7 posts Page 1 of 1
Hi

What is the best way to have someone edit data in a table?

I did read about repeatable regions but wern't sure?

Thank you in advance

Ian
Hi Ian,

While even normal cloned pages can be used for tabular data (viewtopic.php?f=8&t=7262), I think repeatable-regions would be easier for the clients as they visually have a tabular appearance.

Take your pick.
Hi KK

I am trying to understand the repeatable regions but can't work it out for a table?
ianhaney wrote: Hi KK

I am trying to understand the repeatable regions but can't work it out for a table?


ianhaney wrote: Hi KK

I am trying to understand the repeatable regions but can't work it out for a table?


Hi ianhaney!

Ill try to help.

Lets say you declare a repeatable region editable tag :
Code: Select all
<cms:repeatable name='members_age'>
   
   <cms:editable
      name='first_name'
      label='First Name'
      type='text'
   />
   
   <cms:editable
      name='last_name'
      label='First Name'
      type='text'
   />
   
   <cms:editable
      name='age'
      label='First Name'
      type='text'
   />

</cms:repeatable>


And your table will show members first name, last name and members age. So we will craft a table code like this :
Code: Select all
<!DOCTYPE html>
<html>
<head>
<style>
table, th, td {
    border: 1px solid black;
    border-collapse: collapse;
}
th, td {
    padding: 5px;
}
</style>
</head>
<body>

<table style="width:100%">
  <tr>
    <th>Firstname</th>
    <th>Lastname</th>      
    <th>Age</th>
  </tr>
  <tr>
    <td>Jill</td>
    <td>Smith</td>      
    <td>24</td>
  </tr>
  <tr>
    <td>Eve</td>
    <td>Jackson</td>      
    <td>29</td>
  </tr>
  <tr>
    <td>John</td>
    <td>Doe</td>      
    <td>19</td>
  </tr>
</table>

</body>
</html>



So to make it repeat, we need to wrap the table <tr></tr> that contain <td></td> with <cms:show repeatable />. Heres the code :
Code: Select all
<!DOCTYPE html>
<html>
<head>
<style>
table, th, td {
    border: 1px solid black;
    border-collapse: collapse;
}
th, td {
    padding: 5px;
}
</style>
</head>
<body>

<table style="width:100%">

  <!-- Table Head Start -->
  <tr>
    <th>Firstname</th>
    <th>Lastname</th>      
    <th>Age</th>
  </tr>
  <!-- Table Head End -->
 
  <!-- Repeatable Tag (Everything Inside This Tag Gonna be Repeat) -->
  <cms:show_repeatable 'members_age'>
  <tr>
    <td><cms:show first_name /></td>
    <td><cms:show last_name /></td>      
    <td><cms:show age /></td>
  </tr>
  </cms:show_repeatable>
  <!-- Repeatable Tag End-->
 
</table>

</body>
</html>



Hope this help.


Thx!
As soon as possible!

Touch me up : abada[dot]zulma[at]gmail[dot]com
Hi

Thank you for the reply, I understand it all now

Thank you so much GoingMarryAsap

I will give that a go
ianhaney wrote: Hi

Thank you for the reply, I understand it all now

Thank you so much GoingMarryAsap

I will give that a go


Anytime mate ;)
As soon as possible!

Touch me up : abada[dot]zulma[at]gmail[dot]com
Hi

Just a quick update

I did the coding you provided GoingMarryAsap and works perfect, thank you so much again, really appreciate it

Ian
7 posts Page 1 of 1
cron