wbraganca / yii2-dynamicform

It is widget to yii2 framework to clone form elements in a nested manner, maintaining accessibility.
Other
436 stars 438 forks source link

Dynamic form behavior not working properly with javascript alert in yii2 #322

Open IntegrityFoundation opened 2 years ago

IntegrityFoundation commented 2 years ago

I am using Yii2 basic application template. I am using this widget. But In my controller update action I am checking a condition when that condition is executed I am displaying an alert message box in javascript as well as returning the form with model. But after the alert box is displayed the dynamic form columns names appear to big or larger in size as well as the + and - buttons to add and remove the items also appear differently as shown in figure. But when I remove those lines which contains the alert box then it is working fine. How to resolve this?

if($count>0 && ($model->FormationDate!=$dateofformation||$model->JoiningDateWithIF!=$joiningdatewithif))
                    {
                        ob_start();
                        echo "<script language='javascript'>";
                        echo "alert('You cant update the Formation Date or Joining Date With IF because group saving details 
                                                            exists for this group')";
                        echo "</script>";

                        return $this->render('update', [
                'model' => $model,
                'modelsmember' => (empty($modelsmember)) ? [new Memberdetails] : $modelsmember,
            ]);
                        ob_stop();

                    }

image

image1