document.observe("dom:loaded", function() {
var form = $("contactform");
- form.focus();
+ form.setfocus();
form.observe('submit', function(evt) {
var control, errorElements;
$$('.error').invoke('remove');
- errorElements = $$('input:not([type="submit"]),textarea').findAll(
- function(elt) {
- return (!elt.check(function() {
- return !this.value.strip().empty();
- }, SyjStrings.notEmptyField));
- });
+ errorElements = this.checkEmptyElements(SyjStrings.notEmptyField);
if (!errorElements.length) {
control = $("contact_email");
* if there are errors, cancel submission
*/
if (errorElements.length) {
- errorElements[0].focus();
- errorElements[0].select();
+ errorElements[0].highlight('#F08080').activate();
evt.stop();
}
});