Hangfire.Dashboard.Management icon indicating copy to clipboard operation
Hangfire.Dashboard.Management copied to clipboard

Boolean (Checkboxes) parameters are ignored and set always to TRUE

Open agausachs opened this issue 2 years ago • 2 comments

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.

agausachs avatar Feb 23 '23 07:02 agausachs

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(); }

agausachs avatar Jul 13 '23 08:07 agausachs

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

agausachs avatar Jul 13 '23 08:07 agausachs