javascript - is there any Yii widget "Radio Button Set "? -
i'm using bootstrap in project , want radio button set 1 in following link.
<?php $radio = $this->beginwidget('zii.widgets.jui.cjuibutton', array( 'name'=>'checkbox-btn', 'buttontype'=>'buttonset', 'htmltag'=>'span', )); ?> <input type="checkbox" id="check1" value="1" /><label for="check1">checkbox 1</label> <input type="checkbox" id="check2" value="2" /><label for="check2">checkbox 2</label> <input type="checkbox" id="check3" value="3" /><label for="check3">checkbox 3</label> <?php $this->endwidget();?>
but doesn't seem work, renders normal radiobuttonlist unsure emoticon searched in yiistrap, yiiwheels, zii , yiibooster , couldn't find widget similar " radios buttons". should include jquery ui ? prefer using existing widget. suggestion ?
this little heavy of html portion, trick:
$($('#radio-btn').children()).click(function(){ var input = $(this).is('input'); input = input ? $(this).next() : $(this); $('.ui-state-active').removeclass('ui-state-active'); input.addclass('ui-state-active'); $('input').prop('checked','false'); input.prev().prop('checked','true'); });
<script src="http://demo.bsourcecode.com/yiiframework/assets/7c93f9e4/jui/js/jquery-ui.min.js"></script> <link href="http://demo.bsourcecode.com/yiiframework/assets/7c93f9e4/jui/css/base/jquery-ui.css" rel="stylesheet"/> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div id="radio-btn" name="radio-btn" class="ui-buttonset"> <input type="radio" id="radio1" name="radio" value="1" class="ui-helper-hidden-accessible"> <label for="radio1" aria-pressed="false" class="ui-button ui-widget ui-state-default ui-button-text-only ui-corner-left" role="button" aria-disabled="false"><span class="ui-button-text">choice 1</span> </label> <input type="radio" id="radio2" name="radio" value="2" class="ui-helper-hidden-accessible"> <label for="radio2" aria-pressed="false" class="ui-button ui-widget ui-state-default ui-button-text-only ui-corner-left" role="button" aria-disabled="false"><span class="ui-button-text">choice 2</span> </label> <input type="radio" id="radio3" name="radio" value="3" class="ui-helper-hidden-accessible"> <label for="radio3" aria-pressed="false" class="ui-button ui-widget ui-state-default ui-button-text-only ui-corner-right" role="button" aria-disabled="false"><span class="ui-button-text">choice 3</span> </label> </div>
Comments
Post a Comment