I'm building a form where I should insert "Total year billed" or "month by month billed" in dropdown. This is the code with prepended glyphicon icon:
<?= $form->field($model, "total_year_billed" , ['template' => '
<div class="input-group ">
<span class="input-group-addon">
<span class="glyphicon glyphicon-euro"></span>
</span>
{input}
<span class="input-group-addon">
<div class="dropdown">
<a data-toggle="dropdown" href="#" >trim</a>
<ul class="dropdown-menu">
<li>JAN</li>
<li>FEB</li>
<li>MAR</li>
</ul>
</div>
</span>
</div>
{error}{hint}'])->textInput(['maxlength' => true])->label(false) ?>
I'm trying to insert input fields instead of JAN FEB MAR but it won't works:
<?= $form->field($model, "jan")->textInput(['maxlength' => true])->label(false) ?>
The fields jan, feb ecc. are on the same table of "total_year_billed" field.
I solved problem splitting first input field and adding a separate dropdown button. I would prefer just one field with all options but so everything is working.
Now the code figure so:
<div class="col-sm-3">
<?= $form->field($model, "total_year_billed" , ['template' => '
<div class="input-group ">
<div class="input-group ">
<span class="input-group-addon">
<span class="glyphicon glyphicon-euro"></span>
</span>
{input}
</div>
{error}{hint}'])->textInput(['maxlength' => true])->label(false) ?>
</div>
<!-- begin of dropdown fields-->
<div class="col-sm-3">
<div class = "btn-group">
<button type = "button" class = "btn btn-default">Monthly-billed</button>
<button type = "button" class = "btn btn-default dropdown-toggle" data-toggle = "dropdown">
<span class = "caret"></span>
<span class = "sr-only">Toggle Dropdown</span>
</button>
<ul class = "dropdown-menu" role = "menu">
<li>
<?= $form->field($model, "jan" , ['template' => '
<div class="input-group ">
<span class="input-group-addon">
Jan
<span class="glyphicon glyphicon-euro"></span>
</span>
{input}
</div>
{error}{hint}'])->textInput(['maxlength' => true, 'value' => 0])->label(false) ?>
</li>
<li>
<?= $form->field($model, "feb" , ['template' => '
<div class="input-group ">
<span class="input-group-addon">
Feb
<span class="glyphicon glyphicon-euro"></span>
</span>
{input}
</div>
{error}{hint}'])->textInput(['maxlength' => true,'value' => 0])->label(false) ?>
</li>
</ul>
</div>
</div>