rickharrison/validate.js — Issue #7: callback method not working
Author: dtrce
Created: 2011-11-08 03:55:17+00:00
State: open

I have this form validator which has a custom callback but it doesn't work:

```
var customvalidation = new FormValidator('new_form', [{
name: 'custom_field',
display: 'Form Field',
rules: 'callback_check_field'
}], function(errors, event) {
var SELECTOR_ERRORS = $('.error_box'),
SELECTOR_SUCCESS = $('.success_box');

if (errors.length > 0) {
SELECTOR_ERRORS.empty();
SELECTOR_ERRORS.append(errors.join('
'));

SELECTOR_SUCCESS.css({ display: 'none' });
SELECTOR_ERRORS.fadeIn(200);
} else {
SELECTOR_ERRORS.css({ display: 'none' });
SELECTOR_SUCCESS.fadeIn(200);
}

if (event && event.preventDefault) {
event.preventDefault();
} else if (event) {
event.returnValue = false;
}
});
```

callback function

```
customvalidation.registerCallback('check_field', function(value) {
alert("test alert");
return false;
});

```