Form prototype response_parser function response input removeClass err

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
Form.prototype.response_parser = function( response ){
$("input").removeClass('error');
action = response.action;
var insert_errors = function(){
jQuery.each(action.args.errors, function(){
if ( this == '__all__' ) {
$("input").addClass('error');
} else {
$("[name="+this+"]").addClass('error');
}
})
}
var redirect = function(){
window.location = action.args.location;
}
eval(action.func + '()');
}
Form.prototype.ajax_form = function( selector ){
$(selector).ajaxForm({
data: {'selector': selector },
success: this.response_parser,
dataType: 'json'
});
}