prashanth
(Prashanth Kvd)
1
Hi all,
I have a controller and a set of views for that controller,i want to use bootstrap for this views.
Problem is the model for this is not there.So how can i handle this.
Example Code,
<?php /** @var BootActiveForm $form */
$form = $this->beginWidget(‘bootstrap.widgets.TbActiveForm’);
?>
<?php echo $form->textFieldRow($model, ‘textField’, array(‘class’=>‘input-small’)); ?>
<?php echo $form->passwordFieldRow($model, ‘password’, array(‘class’=>‘input-small’)); ?>
<?php $this->widget(‘bootstrap.widgets.TbButton’, array(‘buttonType’=>‘submit’, ‘label’=>‘Log in’)); ?>
<?php $this->endWidget(); ?>
Here what will be the $model in this case?
bettor
(Live Webscore)
2
$model is whatever you’ve assigned to it in your controller/action
prashanth
(Prashanth Kvd)
3
I am not having any model.So right now I am using Chtml to display form fields.
So what to assign for $model?
prashanth
(Prashanth Kvd)
4
<div class="search-form">
<?php $form=$this->beginWidget(‘CActiveForm’, array(
'action'=>Yii::app()->createUrl($this->route),
'method'=>'get',
)); ?>
<?php echo CHtml::label('Name' ,''); ?>
<?php echo CHtml::textField(‘name’, ‘’, array(‘size’=>60,‘maxlength’=>128)); ?>
<?php echo CHtml::label('Qualification' ,''); ?>
<?php
$select = 1;
echo CHtml::dropDownList('qual', $select,
array('0'=>'BE','1'=> 'MCA', '2' => 'MBA', '3' => 'MS',array('empty' => '(Select Qualification)','multiple'=>'multiple'));
?>
<div class="clear"></div><br>
<?php echo CHtml::submitButton('Search'); ?>
</div><!–search form–>
<?php $this->endWidget(); ?>
This is my view file,Here name and qual are just form fields.its not associated with any models.
So how can i add bootstrap to this form fields?
fburhan89
(Sefburhan)
5
<div class="control-group ">
<?php echo CHtml::label(‘Name’ ,’’); ?>
<div class="controls">
<?php echo CHtml::textField(‘name’, ‘’, array(‘size’=>60,‘maxlength’=>128)); ?>
</div> </div>
and for class do like <?php echo CHtml::textField(‘name’, ‘’, array(‘class’=>‘myClass’,‘size’=>60,‘maxlength’=>128)); ?>