In my next application, I want to dynamically load CActiveForms into other CActiveForms with AJAX.
Therefore, I create different form views like this:
$form = $this->beginWidget('CActiveForm', [...]
But it always renders the tag. This results in nested forms:
<form id="form1">
<form id="form2">
</form>
</form>
How do i prevent the CActiveForm from rendering the form tag for form2?
I don’t think it’s possible natively with
CActiveForms. You could however create your own widget which inherits from it. Then you can override theinit()andrun()methods, and take out theecho CHtml::endForm();on line 340 andecho CHtml::beginFormon line 328.Your results may be mixed though, a lot of Javascript and styling etc. relying on having a parent form with some settings etc.