Yii2 textinput () and httml :: submitButton on the same line

0

I need an example in Yii2 that allows me to put some submitButton and textinput () on the same line, as the example below:

part of my code that mounts the buttons:

<?= Html::submitButton(Yii::t('app','Voltar'), ['class' => 'btn btn-primary', 'name' => 'voltar','style' => 'width:78px']) ?>
    <?= Html::submitButton(Yii::t('app','Atualizar'), ['class' => 'btn btn-primary', 'name' => 'atualizar','style' => 'width:80px']) ?>
    <?= Html::Button(Yii::t('app','Apagar'), ['id'=>'btn-confirm','class' => 'btn btn-danger', 'name' => 'apagar','style' => 'width:78px','disabled'=>$desabilitaAPAGA]) ?>
    <?php
    if($habilitaLIGA)
        echo Html::submitButton(Yii::t('app','Ativar'), ['class' => 'btn btn-success', 'name' => 'ativar','style' => 'width:78px']);
    ?>
    <?php
    if($habilitaDESLIGA)
        echo Html::submitButton(Yii::t('app','Desativar'), ['class' => 'btn btn-success', 'name' => 'desativar', 'style' => 'width:80px']);
    ?>
    <?= Html::submitButton(Yii::t('app','Gráfico'), ['class' => 'btn btn-primary', 'name' => 'grafico','style' => 'width:80px']) ?>

I'm waiting for an example to help me.

    
asked by anonymous 31.08.2017 / 01:22

1 answer

1

You can place each control within a div and align them to the left as well as define its size and the space that will have between the other. For example:

<div  style="float:left; margin-left: 10px; width: 100px"> 
    <?= Html::submitButton(Yii::t('app','Voltar'), ['class' => 'btn btn-primary', 'name' => 'voltar','style' => 'width:78px']) ?>
</div>
<div  style="float:left; margin-left: 10px; width: 100px"> 
    <?= Html::submitButton(Yii::t('app','Atualizar'), ['class' => 'btn btn-primary', 'name' => 'atualizar','style' => 'width:80px']) ?>
</div>
<div  style="float:left; margin-left: 10px; width: 100px"> 
   <?= Html::Button(Yii::t('app','Apagar'), ['id'=>'btn-confirm','class' => 'btn btn-danger', 'name' => 'apagar','style' => 'width:78px','disabled'=>$desabilitaAPAGA])
</div>

You can also create a specific definition inside the css for the class that will use the button, so you do not have to repeat the settings like width, margin-left, margin-right, float, etc.

I hope I have helped.

    
04.09.2017 / 05:37