S
S
seryozhasa2018-08-30 10:07:08
Yii
seryozhasa, 2018-08-30 10:07:08

Yii2. Attaching a file in a widget?

Hello. You need to display a popup widget, the widget is called like this

<?php $form = ActiveForm::begin(); ?>
    <?= $form->field($model, 'attribute')->widget(Widget::className()) ?>
    <?= Html::submitButton('Save', ['class' => 'btn btn-success']) ?>
<?php ActiveForm::end(); ?>

In the popup widget itself, I display it like this:
if (условие) {
    require_once __DIR__ . '\popup.php';
}

But the fact is that in the popup, some elements are displayed and a standard filter for them from gii. The filter does not work because it turns out that for it the form block is displayed inside another form block.
So the question is, is it possible to somehow connect a file with a popup to the end of the page like with $this->registerJsFile($url).
Now I see the only way out is to remove the form tag from the search, take the inputs I need and send it with Ajax where I need it.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry, 2018-08-30
@slo_nik

Good afternoon.
That's bullshit.

if (условие) {
    require_once __DIR__ . '\popup.php';
}

Read documentation
The rest is hard to understand. Describe exactly what you need. Please provide the complete code.
Another nonsense.

M
Maxim Timofeev, 2018-08-30
@webinar

popup widget

suggestion missed?
if (условие) {
    require_once __DIR__ . '\popup.php';
}

don't do that
Well, take your modal out of the form, why did you take it out there?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question