Formatting Form Text Fields With Font Awesome Icon


Does anyone know how I can format my Form text fields to look something like:


Screen Shot 2014-11-20 at 1.02.32 PM.png

Here’s what my code looks like so far:

            <?php $form = ActiveForm::begin(['id' => 'form-signup']); ?>

                <!-- <?= $form->field($model, 'username',['options'=>['placeholder'=>'Username']]) ?> -->

				<?= $form->field($model, 'username',							

				['template' => "{input}\n{hint}\n{error}"])->textInput(array('placeholder' => 'Username')); ?>


                <?= $form->field($model, 'password',['template' => "<i class='fa fa-lock'></i>\n{input}\n{hint}\n{error}"])->passwordInput(array('placeholder'=>'Password')) ?>


				<div class="form-actions">

					<input type="submit" value="SIGN IN" class="signin-btn bg-primary">

					<a href="#" class="forgot-password" id="forgot-password-link">Forgot your password?</a>

				</div> <!-- / .form-actions -->

            <?php ActiveForm::end(); ?>


Rise up this issue, thank you so much

Found similar answer

// Input group
echo $form->field($model, 'demo', [
    'inputTemplate' => '<div class="input-group"><span class="input-group-addon">@</span>{input}</div>',

hopefully help, and open for another answers to improve the UI :smile: