Jump to content
Larry Ullman's Book Forums

Yii-Bootstrap Radio Buttons


Recommended Posts



My feedback form works. Which is great. I wanted to have a satisfaction rating (1-10) just radio buttons. So I started to use the Yii-Bootstrap extension. (http://www.cniska.net/yii-bootstrap/) Edward you'll like this.


So I have the following code: Which lies within a

<?php $form=$this->beginWidget('CActiveForm', array(
)); ?>
    <?php echo $form->errorSummary($model); ?>
    <div class="row">
        <?php echo $form->labelEx($model,''); ?>
        <?php echo $form->textField($model,'name', array('placeholder'=>'Name')); ?>
// more code



    <div class="btn-group" data-toggle="buttons-radio">
        <?php echo $form->labelEx($model,'satisfaction') . "\n"; ?>
<?php $this->widget('bootstrap.widgets.TbButtonGroup', array(
    'type' => 'info',
    'toggle' => 'radio', // 'checkbox' or 'radio'
'buttonType' => 'button',
    'buttons' => array(
)); ?>


Lovely, the form displays properly. But I'm not sure how I can tie the input from the satisfaction rating to the form for processing. The HTML generated looks like this:


<div class="btn-group" data-toggle="buttons-radio">
  <label for="FeedbackForm_satisfaction" class="required">Satisfaction <span class="required">*</span></label>
<div class="btn-group" data-toggle="buttons-radio">
<button class="btn btn-info" name="yt0" type="button">1</button>
<button class="btn btn-info" name="yt1" type="button">2</button>
<button class="btn btn-info" name="yt2" type="button">3</button>
<button class="btn btn-info" name="yt3" type="button">4</button>
<button class="btn btn-info" name="yt4" type="button">5</button>
<button class="btn btn-info" name="yt5" type="button">6</button>
<button class="btn btn-info" name="yt6" type="button">7</button>
<button class="btn btn-info" name="yt7" type="button">8</button>
<button class="btn btn-info" name="yt8" type="button">9</button>
<button class="btn btn-info" name="yt9" type="button">10</button>


To me this part of the form seems to be void of a value input. I'd expect some kind of name="FeedbackForm[satisfaction]". So I guess I'm wondering, what am I missing here OR is it easier just to try and style the radio buttons another way?


I feel like I need to make reference to $form..





Link to comment
Share on other sites

I saw that extension before, but i decided just to code in the twitterbootstrap css manually and it all worked perfect. Waiting for the 3 version of bootstrap to come out. Twitter boostrap is good for the buttons and layout but it is lacking for good tables and shading. I will just work it in custom to my yii framework as i will have to override quite a bit of there css to get things 100%

Link to comment
Share on other sites

This thread should be kept in relationsion to Jonathon's question, he mentioned my name here so i gave a short response. Unfortantely i am unable to help him with the question so i have left my response only. On this occasion I have found you to be quite irratating as you give me advise like i know nothing, i am sorry if this comes across as offensive but i was not asking questions about my project.


If you see me asking questions on the forum feel free to help otherwise keep things related to the thread the same as i was told before.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...