No errors on form submission

I have just created a new application and have built two models/crud from the database which seemed to have worked fine. Looking at the site through the browser I can see that the app has retrieved the records that were already in the database.

However, when I try to create or update a record it doesn’t save the new information. It just reloads the page. I think it’s failing validation but there are no error messages. This leaves me with not much to go on.

Any ideas?

I am using Yii 1.1.8

you can check the log (/protected/runtime/application.log) first

After calling $myModel->validate(), you get retrieve an array with all set errors using $myModel->getErrors(). It is well possibly it fails validation on a model property that you are not using in your form. In that case, you should add the property to the ‘safe’ list in your model rules() method.

You might also want to check:

Maybe you are trying to save a record with some required field. Value of this field is null, and the record is not stored on database. Maybe. Try to log your application and/or to change ->save(); operation with ->save(true); The boolean value, permits you to save bypassing validation.

Thanks for the responses.

I didn’t think to check the application log. However I find that it’s not reporting anything.

$myModel->validate() doesn’t return anything either but thanks for pointing me to that article.

->save(true) also does not return anything.

I did manage to solve it though. Following a tutorial I was using the beforeValidate() method in the model file. However I found that it belongs to the controller.