View Single Post
Old 11-23-2012, 03:10 PM   PM User | #2
itborg
New to the CF scene

 
Join Date: Nov 2012
Posts: 6
Thanks: 0
Thanked 1 Time in 1 Post
itborg is an unknown quantity at this point
Hii rain.
About problem 1 - when click on submit , you shuold display all errors , and not only the error for the input that was focused. by the way - after you click on submit - there is no input focused.. so if you want only the last one that was focused you should save it in some variable.
For showing all errors use this code :
Code:
showErrors: function (errorMap, errorList) {
                if (errorList.length) {
                    var errors = errorList[0].message;
                    for (var i = 1; i < errorList.length; i++) {
                        errors += "<br/>" + errorList[i].message
                    }
                    $("span").html(errors);
                }
            }
About problem 2 - i found some hack, don't sure if that is the "perfect" solution but is work like using the Tab key.
Code:
$("form input , form textarea").click(function () {
      $(this).focusout().focus();
});
Hope that help
itborg is offline   Reply With Quote