I know this seems like a common topic in this forum, but as far as I looked, most topics don’t provide a clear solution or the ones given don’t work or I might not implement them properly.
When using ajax to renderPartial() a form the fields with a widget such as DatePicker are not working.
As many topics suggested, I set the 4th parameter to true when using RenderPartial like
return $this->renderPartial( ‘myForm’, [ ‘model’ => $model ], false, true);
but this didn’t change a thing.
Some others topics say we need to set an “id” to the div containing the datepicker in order to reload it using some JS.
in the partially rendered view :
<div class=“col-lg-3” id=“datepicker1”><?= $form->field($model, 'DATE')->widget(DatePicker::classname(), [.....]);?>
in the main view:
what I did, but this still doesn’t work. and I’m not sure how to implement this.
Of course, using renderAjax() would fix this issue but this is not what I want as renderAjax create more trouble for me as it generated the whole form when i just want to get the input as does renderPartial
thank you for your help and enlightment