Home>

1. View definition form to enable Ajax validation

$form=$this->beginwidget ("cactiveform",   array (
   "id" =>"zdzone-form",   "enableajaxvalidation" =>true, //Enable ajax validation
   "enableclientvalidation" =>true, //Enable client validation,Generate js
   "action" =>"/manage/adzone/createadzone",  ));
?>

2. The controller validates the data submitted by ajax

//ajax data validation
if (isset ($_ post ["ajax"])&$_post ["ajax"] === "zdzone-form")
{
  echo cactiveform ::validate ($model);
  yii ::app ()->end ();
}
php
  • Previous Yii Purifier CHtmlPurifier usage example (filtering bad code)
  • Next Summary of FTP related functions in PHP