Error 400 - If The Id Isn't A Number

Hi All,

I’m a newbie of yii, just encountered a problem but don’t know how to solve

If the ID of a record is a string (eg: POS01), when i clicked the update button, it display the "Error 400 - Your request is invalid" error message

Do anyone know how to solve this?



What are your urlManager routes? Often I’ve got one that looks like this:

'<controller:\w+>/<action:\w+>/<id:[\-\d]+>'    => '<controller>/<action>',

The ‘[\-\d]+’ after id tells Yii that the id is supposed to be made of one or more digits and hyphens. Change it to ‘\w+’ to allow strings, same as for controller and action part.

Thanks nineinchnick. It works for me :rolleyes: