C
C
Carlos Rodriguez2015-01-21 17:55:11
Yii
Carlos Rodriguez, 2015-01-21 17:55:11

Yii2. How to force \yii\bootstrap\Modal to send form request?

$menuItems[] = \yii\bootstrap\Modal::widget([
 'id' => 'auth-modal',
                    'toggleButton' => [
                        'label' => \Yii::t('app/auth','login'),
                        'tag' => 'a',
                        'data-target' => '#auth-modal',
                        'href' => Url::toRoute(['/site/login']),
                        'class' => 'headerLogin'
                    ],
                    'clientOptions' => false
                ]);

by clicking on the link, a pop-up appears with an authentication form
by clicking (in the same form) by the link Retrieve password in the same form the password recovery form is loaded
problem: when you close the pop-up and click on the link of the pop-up call, it will not be displayed authentication form and password recovery form
question: is it possible to somehow set in the \yii\bootstrap\Modal settings so that when you click on the link, a request is sent to load the authentication form forcibly (each time)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
C
Carlos Rodriguez, 2015-01-24
@asf

solved by forced loading
in view:

\yii\bootstrap\Modal::widget([
                            'id' => 'auth-modal',
                            'toggleButton' => [
                                ...
                                'class' => 'header-link-login'
                               .....

in js file:
$('a.header-link-login').on('click', function(){
        var form = $('#auth-modal .modal-content');
        $.post(base_url + '/site/login')
            .done(function(result) {
                form.empty().append(result);
            })
    });

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question