Hi I got up to page 210 when I’m supposed to click to add a new user in a project and see a form to add a user.
As far as I know, my code followed the code from the book, except in the Project Controller class I had to add the $id variable to addUser function, perhaps due to a change in versions.
Anyways, I know generally what a 400 error means, but I’m not getting any particular details from my application, even though I have error messages turned on.
Can anyone suggest how I might be able to fix this problem?
You can see the URLs in the various images. Note, I downloaded the code from the book and actually was using it (i.e. copying and pasting it into the application so I didn’t have to type it)
This seems likely to be the case. It does appear you are not following along exactly with the book, which is okay, but there will be differences to deal with. If you were using version 1.1.2 and following strictly with the book, the url to access adding a new user to a project is of the form (assuming project id = 1 and domain name of trackstar):
So you are missing the input identifier. Eliminating this will result in the following code being executed (in the ProjectController::loadModel() method):
throw new CHttpException(404,'The requested page does not exist.');
True, but not the case here. Execution doesn’t reach loadModel() method. Yii uses some Reflection magic to check if the action method has any required parameter. If it has, and the parameter can’t be found in URL, action won’t run and an error 400 will be thrown.