Aboute Renderpartial

I use YII2 to render a activeform with method renderPartial via ajax request,but it can not use the YII validate js; who konw how to use YII2 rederPartial via ajax?

You probably need to add

<?php $this->beginPage(); ?>

<?php $this->beginBody(); ?>

<?php $this->endBody(); ?>

<?php $this->endPage(); ?>

to your partial view.

The thing is, JS for activeform is added to the bottom of the page (registering js code), therefore it is not rendered in case of partial.

Btw I’d also like to know the answer.


Thanks, i think they shuold add the feature for renderPartial for a ajax

but that has some problems, if parent page has jquery.js and some other js resource ,ther render partial page also has those js flies

Yes, but they’re already loaded to browser cache so no performance issues.

Still I’d like to know if there’s an official way of doing this.

Ok, the answer is here, also created an issue