RailsCasts Pro episodes are now free!

Learn more or hide this

Milan Jaric's Profile

GitHub User: mjaric

Comments by Milan Jaric

Avatar

I'm doing ExtJs for some time and bumped to similar problem, at beginning, cause I was lazy to rewrite validation to client side. Then I realized that VALIDATION is not same as BUSINESS RULES in your app.

There is nothing wrong having same validation in UI. It will just prevent UI to make unnecessary round trips to backend. So add that validation in UI. Also, you can pass exceptions for Business rules back to ui by packing exception as nice messages which you can send with HTTP 4xx or 5xx status codes. Or you can add special JSON/XML node which your javascript code will handle before response reaches your UI model.

After all, UI validation is always more restrictive than one which is in service ;)