Hello,
I am trying to add a table, inside a group (tab), containing results and displaying data from other pages.
So first thing I did was creating a "cms:field" on the page I want to display that table, and attributing a "group" to that field.
Inside that field, I have pasted my HTML code. To display a table similar to what is shown in the admin panel, I used the following code:
It's working perfectly.
But my issue is that I wanted to add the "trash" icon in the "col-actions" column, and allowing the user to delete an entry directly from that section.
So I added this line to the "col-actions" column section (last "a" tag):
But it's not working.
So I thought maybe I could add this instead of that "a" tag (adding a form inside the table):
Which I think technically would work, but from what I understand, you cannot nest forms in HTML. Which makes sense because pressing that "Submit" button would try to submit multiple form at once. (I guess?)
Any idea how I could make use of <cms:form> in this case?
I am trying to add a "delete" button here, but I also tried to add (in another page) a text field with a submit button that would generate a page using db_persist_form on another page, from inside that entry admin page. Once again, I cannot use "db_persist_form" because it must be inside a form, and the whole admin edit page is already a form.
Thanks!
I am trying to add a table, inside a group (tab), containing results and displaying data from other pages.
So first thing I did was creating a "cms:field" on the page I want to display that table, and attributing a "group" to that field.
Inside that field, I have pasted my HTML code. To display a table similar to what is shown in the admin panel, I used the following code:
- Code: Select all
<cms:pages masterpage="notifications/contrat-conf.php">
<tr>
<td class="col-date"><span style="fill:green;"><cms:show_icon 'check' />Contract <strong>WORKER</strong></td>
<td class="col-date"><cms:related_pages 'notification_contenu' ><cms:show k_page_title /></cms:related_pages></td>
<td class="col-date"><cms:show date_envoi_contrat_conf/></td>
<td class="col-date"><cms:show destinataire_01/></td>
<td class="col-actions">
<a class="icon tt" href="<cms:admin_link />" title="Modifier">
<svg class="i"><use xlink:href="<cms:show k_site_link />edit/theme/_system/assets/open-iconic.svg#pencil"></use></svg>
</a>
<a class="icon tt" href="<cms:show k_page_link/>" title="Voir">
<cms:show_icon 'magnifying-glass' />
</a>
</td>
</tr>
</cms:pages>
It's working perfectly.
But my issue is that I wanted to add the "trash" icon in the "col-actions" column, and allowing the user to delete an entry directly from that section.
So I added this line to the "col-actions" column section (last "a" tag):
- Code: Select all
<td class="col-actions">
<a class="icon tt" href="<cms:admin_link />" title="Modifier">
<svg class="i"><use xlink:href="<cms:show k_site_link />edit/theme/_system/assets/open-iconic.svg#pencil"></use></svg>
</a>
<a class="icon tt" href="<cms:show k_page_link/>" title="Voir">
<cms:show_icon 'magnifying-glass' />
</a>
<a class="icon tt" href="<cms:show k_page_link/>" title="Voir">
<cms:show_icon 'magnifying-glass' />
</a>
<a href="<cms:db_delete masterpage=k_template_name page_id=k_page_id />">
<cms:show_icon 'trash' />
</a>
</td>
But it's not working.
So I thought maybe I could add this instead of that "a" tag (adding a form inside the table):
- Code: Select all
<cms:form method='post'>
<cms:input name='submit' type="submit" id="delete" class="btn btn-primary" style="background-color:#CD0000;margin-top:15px;" value="Delete" />
<cms:if k_success >
<cms:db_delete masterpage=k_template_name page_id=k_page_id />
<cms:redirect "<cms:admin_link />?o=notifications%2Fcontrat-client-remerciement.php&q=list" />
</cms:if>
</cms:form>
Which I think technically would work, but from what I understand, you cannot nest forms in HTML. Which makes sense because pressing that "Submit" button would try to submit multiple form at once. (I guess?)
Any idea how I could make use of <cms:form> in this case?
I am trying to add a "delete" button here, but I also tried to add (in another page) a text field with a submit button that would generate a page using db_persist_form on another page, from inside that entry admin page. Once again, I cannot use "db_persist_form" because it must be inside a form, and the whole admin edit page is already a form.
Thanks!