dou9022 2016-02-09 13:54
浏览 289

Yii2自定义radioList按钮

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?

enter image description here

  • 写回答

2条回答 默认 最新

  • dongxi0605 2016-02-09 14:10
    关注

    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:"";}
    
    评论

报告相同问题?