Hi guys.
Suppose I have a modal window with ActiveForm in it.
Content for this modal is loaded via AJAX (partial view), so there’s no html/body tags, thus no ActiveForm’s javascript is rendered.
Is it OK to use
<?php $this->beginPage(); ?>
<?php $this->beginBody(); ?>
<!-- MODAL CONTENT HERE -->
<?php $this->endBody(); ?>
<?php $this->endPage(); ?>
inside partials, or there’s much better way (for example, direct access to registered code block)?
STATUS UPDATE: Now this issue is fixed by new function renderAjax.
Fan_Ye
(Fan Ye)
January 27, 2014, 2:42am
2
Hi guys.
Suppose I have a modal window with ActiveForm in it.
Content for this modal is loaded via AJAX (partial view), so there’s no html/body tags, thus no ActiveForm’s javascript is rendered.
Is it OK to use
<?php $this->beginPage(); ?>
<?php $this->beginBody(); ?>
<!-- MODAL CONTENT HERE -->
<?php $this->endBody(); ?>
<?php $this->endPage(); ?>
inside partials, or there’s much better way (for example, direct access to registered code block)?
i think you can resgister the asset bundle for ther active form in ther parent page and in the partial view you just call the method for activeform plugin
No, because
different forms can be loaded into this modal
client validation is different for every form, so different js code must be registered.
Right now I’m using beginPage/endPage inside my partials, works fine.
Just wondering if there’s a better way.
Fan_Ye
(Fan Ye)
January 27, 2014, 10:01am
4
No, because
different forms can be loaded into this modal
client validation is different for every form, so different js code must be registered.
Right now I’m using beginPage/endPage inside my partials, works fine.
Just wondering if there’s a better way.
I mean you just add the validate.form.js and active.form.js in parent page, and in the partial view you just add
<script>
$(function(){
jQuery('#$id').yiiActiveForm($forms->attributes, $fomrs->getClientOptions);
})
<script>
qiang
(Qiang Xue)
January 27, 2014, 1:07pm
5
Is it OK to use
<?php $this->beginPage(); ?>
<?php $this->beginBody(); ?>
<!-- MODAL CONTENT HERE -->
<?php $this->endBody(); ?>
<?php $this->endPage(); ?>
inside partials, or there’s much better way (for example, direct access to registered code block)?
Yes, this is the expected way. We probably will introduce some helper method to simplify this. Could you create a github ticket about this? Thanks.