Update - This seems to be screwing up all of my form validations, not just the date.
I’m using the new date validator in model rules():
array('birthDate, sepDate, hireDate', 'date', 'format'=>'yyyy-MM-dd'),
When I go to save() the value through ajax - AND THE FORMAT IS CORRECT, it does not save(), and returns NO error through CHtml::error.
If I purposely mess up the inputted format, it catches it the error.
Anyone have any suggestions?
I had to add the "unknown error" in the the action, just to see something.
CONTROLLER:
public function actionSubmitUpdate($id){
$model = $this->loadModel($id);
$attribute = $_POST['field'];
$model->$attribute = $_POST['newval'];
if (Yii::app()->request->isAjaxRequest && $model->save()) {
echo CJSON::encode(array(
'status'=>'success',
'attribute'=>$attribute,
'label'=>$model->getAttributeLabel($attribute),
'value'=>$model->getData($attribute),
));
exit;
} else {
if(!CHtml::error($model, $attribute)==''){
echo CJSON::encode(array(
'status'=>'failure',
'error'=>CHtml::error($model, $attribute),
));
} else {
echo CJSON::encode(array(
'status'=>'failure',
'error'=>'An unknown error occurred',
));
}
}
}