Yii Framework Forum: Using Bootstrap Extension In Yii View. - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Using Bootstrap Extension In Yii View. Rate Topic: -----

#1 User is offline   Y!! 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 26
  • Joined: 09-February 13

Posted 16 June 2013 - 09:33 AM

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?
0

#2 User is offline   bettor 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 752
  • Joined: 02-February 09

Posted 16 June 2013 - 09:46 AM

$model is whatever you've assigned to it in your controller/action
0

#3 User is offline   Y!! 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 26
  • Joined: 09-February 13

Posted 16 June 2013 - 10:24 AM

I am not having any model.So right now I am using Chtml to display form fields.
So what to assign for $model?
0

#4 User is offline   Y!! 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 26
  • Joined: 09-February 13

Posted 16 June 2013 - 12:56 PM

<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?
0

#5 User is offline   sefburhan 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 137
  • Joined: 08-February 12
  • Location:islamabad

Posted 16 June 2013 - 11:51 PM

View PostY!!, on 16 June 2013 - 12:56 PM, said:

<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?

<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)); ?>
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users