I upgrade an application to 1.1.1 from 1.0 version and now my forms (update some tables) do not work, it seems not to send post elements.
The forms of the crud command is ok.
Is something known error with this?
I upgrade an application to 1.1.1 from 1.0 version and now my forms (update some tables) do not work, it seems not to send post elements.
The forms of the crud command is ok.
Is something known error with this?
Have you declared the attributes as ‘safe’ in your model?
http://www.yiiframework.com/doc/guide/form.model#safe-attributes-in-1-1
I have many rules but I add
array('usr_surname,usr_email,usr_phone,usr_descr', 'safe','on'=>'profile'),
and
$model= Users::model()->findbyAttributes(array('usr_name'=>Yii::app()->user->name));
$model->scenario='profile';print_r($post);
.....
if(isset($_POST['Users'])) {
$model->attributes=$_POST['Users'];
if( $model->save()) {
...
}...
but nothing happens, I set print_r ($_post) but nothing is here.
Did I miss some configuration?
Try print_r($_POST)
Also check with Firebug what’s posted.
/Tommy
I just upgraded from 1.1.0 to 1.1.1 and all my forms are broken I believe for the same reason. I continue to get “[fieldname] can not be null” even though there is data in the fields on the form. I went though my models and put all the fields into the rules array that marked them as safe. After doing this I was able to CREATE a new record. But then going back to the record and trying to update I not get a new error: General error: 1 near “?”: sql error which doesn’t really tell me what is blowing up. This is the full error:
Description
CDbCommand failed to prepare the SQL statement: SQLSTATE[HY000]: General error: 1 near "?": syntax error
Source File
\framework\validators\CRegularExpressionValidator.php(39)
00027: * meaning that if the attribute is empty, it is considered valid.
00028: */
00029: public $allowEmpty=true;
00030:
00031: /**
00032: * Validates the attribute of the object.
00033: * If there is any error, the error message is added to the object.
00034: * @param CModel the object being validated
00035: * @param string the attribute being validated
00036: */
00037: protected function validateAttribute($object,$attribute)
00038: {
00039: $value=$object->$attribute;
00040: if($this->allowEmpty && $this->isEmpty($value))
00041: return;
00042: if($this->pattern===null)
00043: throw new CException(Yii::t('yii','The "pattern" property must be specified with a valid regular expression.'));
00044: if(!preg_match($this->pattern,$value))
00045: {
00046: $message=$this->message!==null?$this->message:Yii::t('yii','{attribute} is invalid.');
00047: $this->addError($object,$attribute,$message);
00048: }
00049: }
00050: }
00051:
This makes me wonder if 1.1.1 is a beta or where these types of breaking expected. Other than the changelog I haven’t found any more documentation on the new release. Can someone help out or direct me to some more docs that can explain what is going on.