1 /* This file is part of Syj, Copyright (c) 2010 Arnaud Renevier,
2 and is published under the AGPL license. */
3 Element.addMethods('form', {
4 focus: function(form) {
8 error = form.down('.error');
10 tofocus = error.previous('input,textarea');
12 tofocus = form.down('input:not([readonly],[disabled]),textarea:not([readonly][disabled])');
15 if (error && (typeof tofocus.highlight == "function")) {
16 tofocus.highlight('#F08080');
24 Element.addMethods(['input', 'textarea'], {
25 check: function(control, callback, errorMessage) {
26 if (callback.call(control)) {
30 after: new Element("div", {className: 'error'}).update(errorMessage)