我正在构建一个joomla组件,但是我找不到解决以下问题的方法。在我的前端,我使用类JToolbar中的joomlas构建来处理单击事件,比如编辑、删除。
<form action="<?php echo JRoute::_('index.php');?>" method="post"
name="termForm" id="adminForm">
<table class="stripeMe">
<tbody>
<thead>
<tr>
<th>Begriff</th>
<th>Definition</th>
<?php if ($user->authorize('com_glossary', 'edit', 'glossary', 'all')): ?><th>Published</th> <?php endif; ?>
</tr>
</thead>
<?php foreach($this->items as $i => $item): ?>
<tr>
<td>
<span class="title"><?php echo $item->tterm; ?></span>
<?php if ($user->authorize('com_glossary', 'edit', 'bearbeiten', 'all')):?>
<?php echo $this->getEdit(); ?><?php endif; ?>
</td>
<td><?php echo $item->tdefinition; ?></td>
<?php if ($user->authorize('com_glossary', 'edit', 'bearbeiten', 'all')): ?>
<td><?php echo $this->getPublished(); ?></td> <?php endif; ?>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<div>
<input type="hidden" name="task" value="" /> <input type="hidden"
name="id" value="" onclick="submitbutton(<?php echo count( $item->id ); ?>);" /> <input type="hidden"
name="option" value="com_glossary" /> <input type="hidden"
name="controller" value="bearbeiten" />
<?php echo JHtml::_('form.token'); ?>
</div>
</form>我想将所选行的id传递给按钮事件的子控制器,但我不知道怎么做。
发布于 2011-10-25 08:30:09
这里有一些关于在前端JToolbar上使用http://docs.joomla.org/How_to_use_the_JToolBar_class_in_the_frontend的有用技巧
我在过去做过一次,据我所记得,我做了一些技巧,以使它发挥作用。
1.)首先,删除"id“输入,并在表单末尾添加以下输入:
<input type="hidden" name="boxchecked" value="0" />2.)第二,确保将Mootools附加到源
3.)最后:在这里,在"tr“标记之后添加另一个表列:
<td><?php echo JHTML::_('grid.id', $i, $item->id ); ?></td>不要忘记为本专栏在thead中创建列标题。
这些步骤将在每行的第一个单元格中创建一个复选框,并使表单能够发送所选字段的id和request。
编辑: tbody标签在错误的位置,它应该在头标签之后。此外,也没有将事件附加到隐藏输入的使用,因为它们不会被触发
干杯
彼得
https://stackoverflow.com/questions/7873317
复制相似问题