I am new to Yii and how to work with widgets so please be patient. What I want to do is have my TbActiveForm form element look the same as the following code would (I highlighted the part I can not seem to get to work in the Yii widget. I just can’t figure out how to create a <span class=“add-on”> and <i class="…"> tag and values and insert it under the <div>'s created as part of the controlgroup. (If I move the <span> tag down in firebug it works fine:
<form class="form-horizontal" action="index.html" method="post">
<fieldset>
<div class="input-prepend" title="Username">
<span class="add-on"><i class="halflings-icon user"></i></span>
<input class="input-large span10" name="username" id="username" type="text" placeholder="type username"/>
</div>
<div class="clearfix"></div>
<div class="input-prepend" title="Password">
<span class="add-on"><i class="halflings-icon lock"></i></span>
<input class="input-large span10" name="password" id="password" type="password" placeholder="type password"/>
</div>
<div class="clearfix"></div>
<div class="button-login">
<button type="submit" class="btn btn-primary">Login</button>
</div>
<div class="clearfix"></div>
</form>
I have tried all kinds of things but the original Yii TbActiveForm code looks like this:
<?php $form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array('id' => 'login-form',) ); ?>
<fieldset>
<div class="input-prepend" title="Username">
<span class="add-on"><i class="halflings-icon user"></i></span>
<?php echo $form->textFieldControlGroup($model,'username', array( 'class' => 'input-large span10 add-on', 'label' => false, 'placeholder' => 'Username')); ?>
</div>
<div class="clearfix"></div>
<div class="input-prepend" title="Username">
<span class="add-on"><i class="halflings-icon user"></i></span>
<?php echo $form->passwordFieldControlGroup($model,'password', array( 'class' => 'input-large span10', 'placeholder' => 'Password')); ?>
</div>
<div class="clearfix"></div>
<div class="button-login">
<?php echo TbHtml::submitButton('Login', array( 'class' => 'btn btn-primary',)); ?>
<div class="clearfix"></div>
<?php $this->endWidget(); ?>
Any help or direction to articles that would assist me would be appreciated!
S.