how to get value for search in joomla module

by Rhea Lorraine   Last Updated October 19, 2019 10:10 AM - source

how to get value for search in joomla module.

Does anyone know how to get the value for the search field? my problem is that after i search for specific data it still shows everything

In my helper.php I have this code. but doesn't work


    public function getFilterForm()
    {
        JHtml::_('bootstrap.tooltip');
        JHtml::_('behavior.multiselect');
        JHtml::_('formbehavior.chosen', 'select');

        Form::addFormPath(dirname(__FILE__) . '/forms');

        $form = Form::getInstance('module.filter', 'filter');


        return $form;
    }


        public function getFieldsvalue($params)
    {
        $db = JFactory::getDbo();
        $query = $db->getQuery(true);

        $query->select('*')
                ->from('#__users');

        $db->setQuery($query);
        $rows = $db->loadObjectList();

        return $rows;
    }

    public function loadFormData()
    {
        $data = $rows->getFieldsvalue();

        return $data;
    }

I have a folder forms and inside it has filter.xml

in the tmpl folder. the in the default.php this is my code

<form name="adminForm" id="adminForm">
    <?php echo JLayoutHelper::render('joomla.searchtools.default', array ('view' => (object) array ('filterForm' => $form))); ?>

    <table class="table table-striped">
  <thead class="thead-light">
    <tr>
      <th scope="col">#</th>
      <th scope="col">Name</th>
    </tr>
  </thead>
  <tbody>
      <?php foreach  ($rows as $item) {?>
    <tr>
      <th scope="row"><?php echo $item->id; ?></th>
      <td><?php echo $item->name; ?></td>
    </tr>
      <?php } ?>
  </tbody>
</table>
</form>



Related Questions



Call com_ajax from module backend

Updated July 19, 2019 21:10 PM

Joomla: How to make a table view in module-backend?

Updated January 22, 2018 06:10 AM


How to use HTMLHelper to add to the document head

Updated June 01, 2019 13:10 PM