P
P
Pavel Ivanov2014-09-09 10:17:56
Yii
Pavel Ivanov, 2014-09-09 10:17:56

How to rewrite this view in ActiveForm in Yii 2?

Good morning. I'm just getting started with Yii 2.0 and I'm currently rewriting an application that was written in Yii 1.1.
There is a view with a form using jquery-mobile. The task is to save the layout using ActiveForm:

<div data-role="page" id="login">
    <div data-role="header">
        <h2>Авторизация</h2>
    </div>
    <div role="main" class="ui-content jqm-content">
        <form role="form" action="/user/login" method="POST" class="userform">
            <div class="ui-grid-solo">
                <div class="ui-grid-a">
                    <label for="name">Имя</label>
                    <input type="text" name="login" id="login" value="" data-clear-btn="true" data-mini="true">
                    <label for="password">Пароль</label>
                    <input type="password" name="password" id="password" value="" data-clear-btn="true" autocomplete="off" data-mini="true">

                    <input type="checkbox" name="remind" id="remind" value="1">
                    <label for="remind">Запомнить меня</label>
                    <br>
                    <input type="submit" value="Логин" onclick="this.form.submit();">
                </div>
            </div>
        </form>
    </div>
</div>

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Zelenin, 2014-09-09
@paus

stackoverflow.com/questions/24698403/how-to-displa...
there are examples of using active-functions with layout saving

R
redlable47, 2014-09-09
@redlable47

<div class="form">
<?php $form=$this->beginWidget('CActiveForm'); ?>
 
    <?php echo $form->errorSummary($model); ?>
 
    <div class="row">
        <?php echo $form->label($model,'username'); ?>
        <?php echo $form->textField($model,'username') ?>
    </div>
 
    <div class="row">
        <?php echo $form->label($model,'password'); ?>
        <?php echo $form->passwordField($model,'password') ?>
    </div>
 
    <div class="row rememberMe">
        <?php echo $form->checkBox($model,'rememberMe'); ?>
        <?php echo $form->label($model,'rememberMe'); ?>
    </div>
 
    <div class="row submit">
        <?php echo CHtml::submitButton('Войти'); ?>
    </div>
 
<?php $this->endWidget(); ?>
</div><!-- form -->

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question