【问题标题】:How to create Search Box cakephp如何创建搜索框 cakephp
【发布时间】:2023-03-05 10:18:01
【问题描述】:

我是 CakePHP 的新手...我想在我的视图页面中动态创建搜索框而不使用插件。

<div class="box-tools">
    <div class="input-group input-group-sm" style="width: 150px;">
        <input type="text" name="table_search" class="form-control pull-right" placeholder="Search">
        <div class="input-group-btn">
            <button type="submit" class="btn btn-default"><i class="fa fa-search"></i></button>
        </div>
    </div>
</div>

【问题讨论】:

    标签: javascript jquery cakephp-2.0


    【解决方案1】:

    您将不得不使用 CakePHP 提供的 Formhelper。 由于您使用的 Bootstrap 需要输入字段/容器上的特定 div 和类,因此您可以使用以下内容:

    <?=$this->Form->create('Yourmodel')?>
    <div class="box-tools">
        <div class="input-group input-group-sm" style="width: 150px;">
            <?=$this->Form->input('table_search', array('placeholder' => 'Search', 'class' => 'form-control pull-right', 'type' => 'text', 'div' => false, 'label' => false))?>
            <div class="input-group-btn">
                <?=$this->Form->submit('<i class="fa fa-search"></i>', array('escape' => false, 'class' => 'btn btn-default', 'div' => false))?>
            </div>
        </div>
    </div>
    <?=$this->Form->end()?>
    

    【讨论】:

      猜你喜欢
      • 2011-12-27
      • 2012-05-14
      • 1970-01-01
      • 1970-01-01
      • 2017-07-16
      • 2021-04-07
      • 1970-01-01
      • 1970-01-01
      • 2017-12-22
      相关资源
      最近更新 更多