kapur
(Rupak Wms)
May 29, 2014, 12:39pm
1
Hi,
Can anybody please tell me how can i raise the default login page as model popup in yii2?
Thanks
amnah
(Jellysandwich5+1)
June 4, 2014, 3:10pm
3
kapur:
Solved it finally.
How did you solve it? (Could be useful for other people if they come across this thread)
kapur
(Rupak Wms)
June 5, 2014, 7:16am
4
Sure i am providing my code here.
use yii\bootstrap\Modal;
$modelLog = new LoginForm;
<?php
Modal::begin(['id' => 'modal', 'header' => '<h2>Login</h2>']);
?>
<div class="index">
<div class="row">
<div class="col-lg-6 col-md-6 col-sm-6">
<?php $form = ActiveForm::begin([
'id'=> 'login-form',
'action' => 'login',
]); ?>
<div><?php echo $form->errorSummary($modelLog); ?></div>
<?php echo $form->field($modelLog, 'username') ?>
<?php echo $form->field($modelLog, 'password')->passwordInput() ?>
<div class="form-group"><?php echo Html::submitButton('Login', ['class' => 'btn btn-primary']); ?></div>
<?php ActiveForm::end(); ?>
</div>
</div>
</div>
<?php
Modal::end();
?>
Hi,
Where should I put this code? in layout/main.php or anywhere else?
Thank you.
How I can make a link for show this modal?
adinugro
(Adinugro)
August 22, 2016, 3:22am
7
I am also interested in this. I believe you cannot put in views/layouts/main.php, since in layout you cannot add a model. You should create a widget in yii 1.1, but I am not sure how can you make a widget in yii2? I am new to yii2.
https://github.com/shi-yang/yii2-login-widget <-- is example of widget, but need to change it to modal popup, anyone can help to proceed?
Daniel