yiisoft/yii — pull request #1503 by zdenekca (2012-09-30 23:46:16+00:00)
Title: Focus on the first input field of a form when error occurs

Currently if user submits a form and one or more fields have validation
errors, the focus is set on the first form field or not at all.

For better user experience we should let browser to focus on the first
input field that has validation error (which can be in the middle of the
form).

This is especially useful for forms that are large and long. It will
help user to immediately see the error field without the need to scroll
or even know what to do.

This works well for my website. The solution uses input field offsets so
that the form can have any markup around it.