Yii2:如何在Jquery中使单选按钮不可点击

时间:2015-07-16 19:42:26

标签: javascript php jquery yii2

<?php
$script = <<< JS

$(':radio').on('change', function() 
{   $(':radio:checked').closest('label').prevAll('label').children(':radio').prop('disabled', true);
})
.trigger('change');

JS;
$this->registerJs($script);
?>

enter image description here

FORM Field

<?php  echo $form->field($model, 'status')->radioButtonGroup($model->getStatusList(),['disabledItems'=>[]]); ?>

HTML

<div class="form-group field-status-status required">
<label class="control-label" for="tum">Status</label>
<input type="hidden" name="Status[status]" value=""><div id="tum" class="btn-group" data-toggle="buttons">
<label class="btn btn-default"><input type="radio" name="Status[status]" value="APPROVED"> Approved</label>
<label class="btn btn-default active"><input type="radio" name="Status[status]" value="DIGITAL" checked> Digital</label>
<label class="btn btn-default"><input type="radio" name="Status[status]" value="CDP"> CDP</label>
<label class="btn btn-default"><input type="radio" name="Status[status]" value="PRINT"> Print</label>
<label class="btn btn-default"><input type="radio" name="Status[status]" value="OTHERPROCESS"> OtherProcess</label>
<label class="btn btn-default"><input type="radio" name="Status[status]" value="PACKING"> Packing</label>
<label class="btn btn-default"><input type="radio" name="Status[status]" value="DISPATCH"> Dispatch</label></div>

如图所示,已批准是禁用按钮但仍可点击,它应该完全灰色不可点击如何实现这一点?

0 个答案:

没有答案