如何在单击其他选项卡Joomla Custom Component时隐藏选项卡1内容

时间:2014-12-01 06:40:54

标签: tabs joomla3.0

我有一个编辑视图,其中我需要为报告的行项目(字段)添加一个Tab。第一个选项卡是报告的编辑表单。我想在第二个标签中创建一个列表。

<form action="<?php echo JRoute::_('index.php?option=com_reports&layout=edit&id=' . (int) $this->item->id); ?>" method="post" enctype="multipart/form-data" name="adminForm" id="newreport-form" class="form-validate">

<div class="form-horizontal">

    <!-- Tab Initialization -->
    <?php echo JHtml::_('bootstrap.startTabSet', 'myTab', array('active' => 'general')); ?>
    <!-- here is my 1st tab -->

    <?php echo JHtml::_('bootstrap.addTab', 'myTab', 'general', JText::_($this->item->title. '`s details', true)); ?>
    <div class="row-fluid">
        <div class="span10 form-horizontal">
            <fieldset class="adminform">

                                <input type="hidden" name="jform[id]" value="<?php echo $this->item->id; ?>" />
        <div class="control-group">
            <div class="control-label"><?php echo $this->form->getLabel('title'); ?></div>
            <div class="controls"><?php echo $this->form->getInput('title'); ?></div>
        </div>
        <div class="control-group">
            <div class="control-label"><?php echo $this->form->getLabel('isactive'); ?></div>
            <div class="controls"><?php echo $this->form->getInput('isactive'); ?></div>
        </div>
        <div class="control-group">
            <div class="control-label"><?php echo $this->form->getLabel('description'); ?></div>
            <div class="controls"><?php echo $this->form->getInput('description'); ?></div>
        </div>
        <div class="control-group">
            <div class="control-label"><?php echo $this->form->getLabel('created_by'); ?></div>
            <div class="controls"><?php echo $this->form->getInput('created_by'); ?></div>
        </div>
        <div class="control-group">
            <div class="control-label"><?php echo $this->form->getLabel('modified_by'); ?></div>
            <div class="controls"><?php echo $this->form->getInput('modified_by'); ?></div>
        </div>

        <?php
            foreach((array)$this->item->modified_by as $value): 
                if(!is_array($value)):
                    echo '<input type="hidden" class="modified_by" name="jform[modified_byhidden]['.$value.']" value="'.$value.'" />';
                endif;
            endforeach;
        ?>          <div class="control-group">
            <div class="control-label"><?php echo $this->form->getLabel('date_created'); ?></div>
            <div class="controls"><?php echo $this->form->getInput('date_created'); ?></div>
        </div>
        <div class="control-group">
            <div class="control-label"><?php echo $this->form->getLabel('date_modified'); ?></div>
            <div class="controls"><?php echo $this->form->getInput('date_modified'); ?></div>
        </div>


            </fieldset>
        </div>
    </div>

   <!-- here is my 2nd tab -->
   <?php echo JHtml::_('bootstrap.addTab', 'myTab', 'fields', JText::_('Fields', true)); ?>



    <?php echo JHtml::_('bootstrap.endTab'); ?>

    <?php echo JHtml::_('bootstrap.endTabSet'); ?>

    <input type="hidden" name="task" value="" />
    <?php echo JHtml::_('form.token'); ?>

</div>

一切都很好但是当我点击第二个标签时,标签1中的表单仍然显示。我究竟做错了什么?我只想在单击第二个选项卡时隐藏选项卡1中的表单。

1 个答案:

答案 0 :(得分:0)

我自己得到了答案。

我只需要为我添加的每个标签添加此代码:

<?php echo JHtml::_('bootstrap.endTab'); ?>