gpt4 book ai didi

php - float 标签在 yii2 中不起作用

转载 作者:行者123 更新时间:2023-11-28 15:43:29 25 4
gpt4 key购买 nike

我在 yii2 basic 中创建了一个表单,并使用 Material 设计来启用 float 标签,但是当我单击输入字段时,它的标签并没有 float 在上方。这是我的表单代码。

    <?php
$form = ActiveForm::begin([
'action' => ['index'],
'method' => 'get',
]);
?>


<div class="panel-body container-fluid">

<div class="row">
<div class="col-md-12">
<div class="col-xs-6 col-lg-6">

<div class="form-group form-material floating" data-plugin="formMaterial">
<?= $form->field($model, 'corporation_name',[ 'labelOptions' => [ 'class' => 'floating-label' ]])->textInput(['maxlength' => true, 'class' => 'form-control'])->label('Corporation Name') ?>
</div>

<div class="form-group form-material floating" data-plugin="formMaterial">
<?= $form->field($model, 'user_first_name',[ 'labelOptions' => [ 'class' => 'floating-label' ]])->textinput(['class' => 'form-control'])->label('Corporation Admin'); ?>
</div>
</div>
<div class="col-xs-6 col-lg-6">
<div class="form-group form-material floating" data-plugin="formMaterial">
<div class="example"> <b role="presentation"></b>
<?= $form->field($model, 'corporation_status')->dropDownList(Yii::$app->appstatues->status, ['prompt' => 'Status'])->label(false); ?>
</div>
</div>
</div>
</div>
<div class="col-md-12">
<div class="form-group form-material floating m-t-27" data-plugin="formMaterial">
<?= Html::submitButton('Search', ['class' => 'btn-primary btn waves-effect waves-light waves-effect']) ?>
<?= Html::resetButton('Reset', ['class' => 'btn-primary btn waves-effect waves-light waves-effect', 'onclick' => 'location.href = "/admin/corporations";']) ?>

</div>
</div>
</div>

</div>
<?php ActiveForm::end(); ?>

</div>

谁能告诉我我做错了什么?

最佳答案

你看过inspect元素了吗?

如果我理解你的话......

尝试移除输入表单周围的 div。当您为模型绑定(bind)表单时,您已经在输入周围设置了 div。试试这个...

<?= $form->field($model, 'ime',['options'=>['class'=>'form-group form-material floating', 'data-plugin'=> 'formMaterial'], 'labelOptions' => [ 'class' => 'floating-label' ]])->textInput(['maxlength' => true, 'class' => 'form-control'])->label('Corporation Name') ?> 

关于php - float 标签在 yii2 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43138902/

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