dimagi/commcare-hq — pull request #765 by esoergel (2013-07-29 19:17:06+00:00)
Title: Added client-side validation to case type field in the app_manager

As the user types in a case_type, the browser will check against the defined pattern `^[\w-]+$`, and and mark it as `:invalid`. The javascript validator looks for that and displays error text. The problem with this browser validation is (at least in FF), it only highlights the input box red when it's selected. The way I've implemented it, the error message will stay, though.

On save, the error message is hidden. If the user saves an invalid pattern, the server sends back the previous version (or an empty string), which auto-populates the field silently. I'm not sure if this is ideal, even if the user will have notifications that the pattern is invalid while they type it (assuming modern browser and JS, of course).