简体   繁体   English

如何在yii2中更改默认表单输入大小

[英]how to change the default form input size in yii2

i have creted a form by gii CRUD application. 我已经通过gii CRUD应用程序创建了表格。 but the form has very wide input fields i don't want that much wide input fields. 但是表单有非常宽的输入字段,我不想那么宽的输入字段。 how can i do that. 我怎样才能做到这一点。 Any suggestion are highly welcome.my form code is. 任何建议都非常欢迎。我的表单代码是。

<?php $form = ActiveForm::begin(); ?>

<?= $form->field($model, 'group_name')->textInput(['maxlength' => true]) ?>

<?= $form->field($model, 'group_num')->textInput() ?>

<?= $form->field($model, 'num_member')->textInput() ?>

<?= $form->field($model, 'monthly_prm')->textInput() ?>


<?= $form->field($model, 'chit_sdate')->textInput(['placeholder'=> "dd-mm-yy"]) ?>

<?= $form->field($model, 'chit_cdate')->textInput(['placeholder'=> "dd-mm-yy"]) ?>

<div class="form-group">
    <?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
</div>

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

got my answer... :) just add these in when your active form begins add do changes accordingly 得到了我的答案... :)只需在活动表单开始时添加这些内容,然后相应地进行更改即可

<?php $form = ActiveForm::begin([
        'id' => 'login-form',
        'options' => ['class' => 'form-horizontal'],
        'fieldConfig' => [
            'template' => "{label}\n<div class=\"col-lg-3\">{input}</div>\n<div class=\"col-lg-8\">{error}</div>",
            'labelOptions' => ['class' => 'col-lg-1 control-label'],
        ],
    ]); ?> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM