1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-04 13:47:31 +02:00

Fix for unchecked-checkbox value submission.

This commit is contained in:
Lóna Lore
2017-03-03 00:03:31 +01:00
parent 81b53dccf3
commit b91351c5ed
2 changed files with 33 additions and 9 deletions

View File

@@ -18,12 +18,36 @@ var e107 = e107 || {'settings': {}, 'behaviors': {}};
{
$('input[name="' + name + '"]', context).once('bootstrap-switch-init').each(function ()
{
$(this).bootstrapSwitch({
size: options.size || 'mini',
onText: options.onText || null,
offText: options.offText || null,
wrapperClass: options.wrapperClass || null
});
if($(this).attr('type') != 'hidden')
{
$(this).bootstrapSwitch({
size: options.size || 'mini',
onText: options.onText || null,
offText: options.offText || null,
wrapperClass: options.wrapperClass || null
});
$(this).on('switchChange.bootstrapSwitch', function (event, state) {
var name = $(this).attr('name');
var checked = true;
if(state === false)
{
checked = false;
}
var value = checked ? 1 : 0;
if(options.inverse)
{
// value = checked ? 0 : 1;
}
$('input[type="hidden"][name="' + name + '"]').val(value);
event.preventDefault();
});
}
});
});
}