gpt4 book ai didi

twitter-bootstrap - 如何在 yii2 alpha 中将 bootstrap3 图标添加到事件表单中

转载 作者:行者123 更新时间:2023-12-04 17:35:08 25 4
gpt4 key购买 nike

这就是我添加带有文本字段的图标的方式。还添加了生成输出的图像。
我不想使用 Krajee Yii Extensions .所以我开始阅读文档。

$form =  \yii\widgets\ActiveForm::begin([
'id' => 'form-id',
'options' => ['class' => 'form-horizontal'],
'enableClientValidation'=> false,
'enableAjaxValidation'=> true,
'validateOnSubmit' => true,
'validateOnChange' => true,
'validateOnType' => true,
'action' => 'youraction',
'validationUrl' => 'yourvalidation'
]);

echo $form->field($model, 'fieldname')->begin();
echo Html::activeLabel($model,'fieldname', ["class"=>"col-sm-3 control-label"]); ?>
<div class="input-group col-sm-4 ">
<span class="input-group-addon">
<span class="glyphicon glyphicon-subtitles"></span>
</span>
<?php echo Html::activeTextInput($model, 'fieldname', [
'class'=>'form-control',
'autocomplete'=>'off'
]
); ?>
</div>
<?php echo Html::error($model,'origin', ['class' => 'help-block']);
echo $form->field($model, 'origin')->end();

\yii\widgets\ActiveForm::end();

Example View

最佳答案

这是一个问题,还是您正在向我们展示您是如何做到的?

您还应该能够执行以下操作:

<?= $form->field($model, 'fieldname', ['template' => '
<div class="col-sm-2">{label}</div>\n
<div class="col-sm-10">
<div class="input-group col-sm-4 ">
<span class="input-group-addon">
<span class="glyphicon glyphicon-subtitles"></span>
</span>
{input}
</div>
{error}{hint}
</div>'])->textInput(['data-default' => '']) ?>

关于twitter-bootstrap - 如何在 yii2 alpha 中将 bootstrap3 图标添加到事件表单中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22688204/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com