I have this code in Yii2:
<?= $form->field($model, 'username',$opzioni)->textInput(array('placeholder' => 'Username')); ?>
generate this:
<div class="input-icon field-loginform-username required">
<label class="control-label" for="loginform-username">Username</label>
<input id="loginform-username" class="form-control" type="text" placeholder="Username" name="LoginForm[username]">
<div class="help-block"></div>
</div>
and i want to do this
<div class="input-icon field-loginform-username required">
<label class="control-label" for="loginform-username">Username</label>
**<i class="fa fa-user"></i>**
<input id="loginform-username" class="form-control" type="text" placeholder="Username" name="LoginForm[username]">
<div class="help-block"></div>
</div>
It's possible with the original source?
refering to http://stuff.cebe.cc/yii2docs/yii-widgets-activefield.html#$template-detail
template = "{label}\n{input}\n{hint}\n{error}"
your code should be like this:
<?= $form->field($model, 'username', [
'template' => "{label}\n<i class='fa fa-user'></i>\n{input}\n{hint}\n{error}"
])->textInput(array('placeholder' => 'Username')); ?>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With