Manually validate before send

Validation was happening, but was not preventing sending.  We now
just manually call the validation function in compose.finish()
instead of relying on jquery.form's beforeSubmit option.

(imported from commit e094832bf8948f4c6f58cc0d0923bf0fd09db4b1)
This commit is contained in:
Zev Benjamin
2012-10-29 17:37:34 -04:00
parent 696a04743a
commit bdb0ac73a3

View File

@@ -57,7 +57,6 @@ $(function () {
send_options = {
dataType: 'json', // This seems to be ignored. We still get back an xhr.
beforeSubmit: function () { compose.validate(); },
success: function (resp, statusText, xhr, form) {
form.find('textarea').val('');
send_status.hide();
@@ -92,9 +91,13 @@ $(function () {
});
exports.finish = function () {
if (! compose.validate()) {
return false;
}
$("#compose form").ajaxSubmit(send_options);
is_composing_message = false;
$(document).trigger($.Event('compose_finished.zephyr'));
return true;
};
$(function () {