43 } |
43 } |
44 |
44 |
45 function validatePrefsForm(formid) { |
45 function validatePrefsForm(formid) { |
46 clearPreviousMessages(); |
46 clearPreviousMessages(); |
47 _clearPreviousErrors(formid); |
47 _clearPreviousErrors(formid); |
48 return validateForm(formid, null, submitSucces, submitFailure); |
48 return validateForm(formid, null, submitSuccess, submitFailure); |
49 } |
49 } |
50 |
50 |
51 function submitFailure(result, formid, cbargs) { |
51 function submitFailure(result, formid, cbargs) { |
52 var $form = jQuery('#' + formid); |
52 var $form = jQuery('#' + formid); |
53 var dom = DIV({'class': 'critical'}, _("please correct errors below")); |
53 var dom = DIV({'class': 'critical'}, _("please correct errors below")); |
57 _displayValidationerrors(formid, descr[0], descr[1]); |
57 _displayValidationerrors(formid, descr[0], descr[1]); |
58 $form.find('span.error').next().focus(); |
58 $form.find('span.error').next().focus(); |
59 return false; // so handleFormValidationResponse doesn't try to display error |
59 return false; // so handleFormValidationResponse doesn't try to display error |
60 } |
60 } |
61 |
61 |
62 function submitSucces(result, formid, cbargs) { |
62 function submitSuccess(result, formid, cbargs) { |
63 var $form = jQuery('#' + formid); |
63 var $form = jQuery('#' + formid); |
64 setCurrentValues($form); |
64 setCurrentValues($form); |
65 var dom = DIV({'class': 'msg'}, _("changes applied")); |
65 var dom = DIV({'class': 'msg'}, _("changes applied")); |
66 $form.find('div.formsg').empty().append(dom); |
66 $form.find('div.formsg').empty().append(dom); |
67 $form.find('input').removeClass('changed'); |
67 $form.find('input').removeClass('changed'); |
68 checkValues(form, true); |
68 checkValues($form, true); |
69 return; |
69 return; |
70 } |
70 } |
71 |
71 |
72 function clearPreviousMessages() { |
72 function clearPreviousMessages() { |
73 jQuery('div#appMsg').addClass('hidden'); |
73 jQuery('div#appMsg').addClass('hidden'); |