build customized Form using Active form

Hello;

I have form that I would like to group and organise controls on it; but the problem I am facing is using ActiveForm. Active form is wrapping controls with divs and is not allowing to group or to organise controls as I want. So is there any other way to build form having full control on it and still being possible to use Yii features such as enableAjaxValidation, loading the model directly in the form so that the user edit…

if activeform can be controlled in that way please let me know how

You could use \yii\helpers\Html methods to write input controls code.

Use this widget to make some deeper form custmonization:

http://demos.krajee.com/widget-details/active-form

You can always wrap your active form into another class, and custmonize it throught CSS to get the effect only in one place.

I think this can help; can you show me one example of making a form where ajaxvalidation is enable and client validation is enable and the model has attribute are login and password and rememberme wich is a checkbox that is checked by default.

Thanks




    <?php 

        $form = ActiveForm::begin([

            'id' => 'login-form-vertical', 

            'type' => ActiveForm::TYPE_VERTICAL,

            'id' => "some_form",

            'action' => ['user/edit'],

            'options' => ['class' => 'edit_form'],

            'enableAjaxValidation' => true,

            'enableClientValidation' => true,

        ]); 

    ?>

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

        <?= $form->field($model, 'password')->passwordInput() ?>

        <?= $form->field($model, 'rememberMe')->checkbox() ?>

        <div class="form-group">

            <?= Html::submitButton('Login', ['class' => 'btn btn-primary']) ?>

            <?= Html::resetButton('Reset', ['class' => 'btn btn-default']) ?>

        </div>

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

I know how to do that my problem is avoiding using activeform because it adds div with form-group class wich I dont want; How can I avoid that? and I wanna arrange fields on my form.

How suggested previously, you can use Html such as:

If you have $model you can use




Html::activeTextInput(...)



Otherwise:




Html::textInput(...)



You can remove that class with jQuery for example