2

我正在使用kartik文件输入扩展,我想为每张图片添加一个单选按钮,以便用户可以选择必要的照片,我的代码是:

<?= $form->field($model, 'imageFiles[]')->widget(FileInput::classname(), [

    'options' => ['multiple' => true, 'accept' => 'image/*', 'id'=>'inputFile'],

    'pluginOptions' => [
        'layoutTemplates' => ['preview'=>

            "    <div class='file-preview-thumbnails'>\n" .
            "    </div>\n" .
            "    <div class='clearfix'></div>" .
            "    <div class='file-preview-status text-center text-success'></div>\n".
            "    <div class='kv-fileinput-error'></div>\n",

            'footer' => "<div class=\'file-thumbnail-footer\'>\n" .
                "    <div class='file-caption-name' style='width:{width}'>{caption}</div>\n" .
                "    {progress} {actions}" .
                '<div><br>
                                                <div class="radio-btn">

                                                <input type="radio" value={caption} id="rc1" name="rc1" checked="checked">

                                                <label for="rc1" onclick><span class="label label-default" style="font-size: 1em;">Main image</span></label>

                                                </div></div>'.
                "</div>"
        ],
        'uploadUrl' => '/ads/create',
        'maxFileCount' => 4,
        'showUpload' => false,
        'showCaption' => false,
        'showClose' => false,
    ]
]);
?>

我想根据选择的任何文件进行<input type="radio" value={caption} id="rc1">更改,请指导我,谢谢。<input type="radio" value=FILENAME id="rc1">

4

0 回答 0