Hangfire.Dashboard.Management
Hangfire.Dashboard.Management copied to clipboard
Boolean (Checkboxes) parameters are ignored and set always to TRUE
Every time I create a recurring task of a job with a boolean parameter, it's set to TRUE even if I didn't checked it.
I think the problem is at line 58 of management.js:
$("input[id^='" + id + "']", container).each(function () { send[$(this).attr('id')] = $(this).val();
});``
When applied on a checkbox input, it always returns "on". I think it should be:
if ($(this).attr('type') == "checkbox") { send[$(this).attr('id')] = $(this).prop("checked"); } else{ send[$(this).attr('id')] = $(this).val(); }
In fact, lcourson solves like this in its "Hangfire.Dashboard.Management.v2" repo:
$("input[id^='" + id + "']", container).each(function () { if ($(this).is('[type=checkbox]')) { if ($(this).is(':checked')) { send[$(this).attr('id')] = "on"; } } else { send[$(this).attr('id')] = $(this).val(); } });
https://github.com/lcourson/Hangfire.Dashboard.Management.v2/blob/master/src/Content/management.js