Make fields on form disabled if Enabled not checked.

This commit is contained in:
Boris Gulay
2016-05-20 18:00:41 +03:00
parent 40e7f5664e
commit 95716183d7
2 changed files with 11 additions and 1 deletions

View File

@@ -1,14 +1,24 @@
/*
* This is part of identity_imap plugin
*/
$(function() {
if ($('#plugin-ident_switch-account').size() > 0) {
$('#plugin-ident_switch-account').prependTo('.topright');
$('.topright .username').hide();
$('#plugin-ident_switch-account').show();
}
var $enFld = $("INPUT[name='_ident_switch.form.enabled']");
if ($enFld.size() == 1)
$enFld.change();
});
function plugin_switchIdent_enabled_onChange(e) {
var $enFld = $("INPUT[name='_ident_switch.form.enabled']");
$("INPUT[name!='_ident_switch.form.enabled']", $enFld.parents("FIELDSET")).prop("disabled", !$enFld.is(":checked"));
}
function plugin_switchIdent_switch(val) {
console.log("qwe1");
rcmail.http_post('plugin.ident_switch.switch', { '_ident-id': val });