M
M
mihail19922015-08-02 20:44:38
JavaScript
mihail1992, 2015-08-02 20:44:38

After updating the code section containing the form fields via ajax, does the axaj-validation of the fields disappear?

After updating the code section containing the form fields via ajax, the axaj-validation of the fields disappears. Please, prompt in what there can be a business and where to dig? It is very important that the validation rules are checked right after filling in the form
fields ; } return $this->render('index',['params'=>$params]); In view I use ActiveForm

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander, 2015-08-02
Madzhugin @Suntechnic

Where to dig? Why should she work at all? The page loaded, validation was hung on the fields. The fields have changed. Why should it work if the fields are different now? Those on which it was hung no longer exist.
After replacing the fields, rehang the validation.

M
mihail1992, 2015-08-02
@mihail1992

I use the YiiActiveForm form widget, so the view requires connection or generation (from yii) of javascript code, but js, as I understand it, will neither be connected nor displayed. And in my case with YiiActiveForm, this led to the fact that client-side javascript and ajax validation stopped working. The fields on which the ajax validation was hung remained the same.
if(Yii::$app->request->isAjax){
return $this->renderPartial('agent_ajax',['params'=>$params]);
}
return $this->render('index',['params'=>$params]);
Tried replacing renderPartial with renderAjax, didn't help

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question