Don't lose disabled setting on email config submit (#441)

This commit is contained in:
FrancescoUK
2016-06-23 20:43:09 +01:00
parent 6c9c28bd28
commit 413fef4c6f
2 changed files with 21 additions and 5 deletions

View File

@@ -115,10 +115,6 @@
//validation and submit handling
$(document).ready(function()
{
$('#email_config_form').validate($.extend(form_support.handler, {
errorLabelContainer: "#email_error_message_box"
}));
var check_protocol = function() {
if($("#protocol").val() == 'sendmail')
{
@@ -137,5 +133,24 @@ $(document).ready(function()
};
$("#protocol").change(check_protocol).ready(check_protocol);
$('#email_config_form').validate($.extend(form_support.handler, {
submitHandler: function(form) {
$(form).ajaxSubmit({
beforeSerialize: function(arr, $form, options) {
$("#mailpath, #smtp_host, #smtp_user, #smtp_pass, #smtp_port, #smtp_timeout, #smtp_crypto").prop("disabled", false);
return true;
},
success: function(response) {
$.notify(response.message, { type: response.success ? 'success' : 'danger'} );
// set back disabled state
check_protocol();
},
dataType:'json'
});
},
errorLabelContainer: "#email_error_message_box"
}));
});
</script>

View File

@@ -77,8 +77,9 @@ $(document).ready(function()
$("#sales_invoice_format, #recv_invoice_format, #invoice_default_comments, #invoice_email_message").prop('disabled', !invoice_enable);
return arguments.callee;
})();
$("#invoice_enable").change(enable_disable_invoice_enable);
$('#invoice_config_form').validate($.extend(form_support.handler, {
submitHandler: function(form) {
$(form).ajaxSubmit({