How to customize the look and feel of yii2 radio list button.
<?= $form->field($model, 'gender')->radioList(array('1' => 'One', 2 => 'Two'), array('template' => "<td>{input}</td><td>{label}</td>")); ?>
I need to get the required sign only on Gender label?
Maybe you can trick what is displayed with some CSS ? You can hide the stars for the radio buttons and keep the one on the field ?
I don't know the exact HTML generated (can you provide the html), so it's hard to give an example of the CSS. Maybe something like
FIELD LABEL .star {display:none;}
or maybe (really depends on the HTML/CSS generated by Yii2)
FIELD LABEL::after {content:"";}
You should check your css rules (not yii2 or bootstrap, yours) since there is no such rules by default in yii2/bootstrap.
You could simply use :
.form-group.required label.control-label:after {
content: " *";
color: #a94442;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.