MemberController.php
public function actionEditInfo()
{
$model = EditInfoForm::findOne(Yii::$app->user->id);
//ajax验证
if (Yii::$app->request->isAjax && $model->load(Yii::$app->request->post())) {
Yii::$app->response->format = Response::FORMAT_JSON;
return ActiveForm::validate($model);
}
if (Yii::$app->request->isPost && $model->load(Yii::$app->request->post()) && $model->validate()) {
$model->save();
}
return $this->render('setting-info', ['model' => $model]);
}
view.php
[
'template'=> "{input}{error}"//重要
]
]); ?>
生日
field($model, 'birthday', ['enableAjaxValidation' => true])->input('text',['id'=>'startTime','class'=>'cred-inp datainp']); ?>//重要
'grse-listr-qrtj']) ?>
版权声明:本文为u011299210原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。