1

How can I edit the _search view (which is implemented by Yii2 Crud Generator), so that I can make two form fields on the same line? (Note that I have resized the form fields to 500px so that they can fit one line). Also, I would like the 'Search' and 'Reset' buttons to be on the same line too.

enter image description here

Ragheb AlKilany
  • 913
  • 3
  • 11
  • 20

1 Answers1

3

You can use options and assign eg: a proper twitter-bootstrap grid width

this way :

<?php echo $form->field($model, 'your_filed', ['options' => ['class' => 'col-md-4', ]]) ?>
ScaisEdge
  • 131,976
  • 10
  • 91
  • 107
  • Thanks again :D I used it and it worked but if it could work, i need search and reset buttons on the same line as the fields, and 'create car' on another line. @scaisEdge – Ragheb AlKilany Sep 13 '15 at 14:33
  • I see the layout. you must insert a div for break after the two field or enlarge the width of the field eg: md-6 for a better display – ScaisEdge Sep 13 '15 at 14:34
  • I really appreciate everything man :) But what should I do to make the buttons on the same level as the fields , and not the fields' labels? @scaisEdge – Ragheb AlKilany Sep 13 '15 at 14:39
  • The problem lies in the fact that the earch and reset buttons are placed in `
    `. The form-group can take off without problems is just a way to format the page and at this point you can line up the buttons with the fields where such use col-md-1, or if the sum of the field `col` not ecced 12
    – ScaisEdge Sep 13 '15 at 14:46
  • Thanks a lot, I'm gonna try to find a solution for this myself.. Regards – Ragheb AlKilany Sep 13 '15 at 14:50