Using a Sitefinity MVC form with the Checkboxes control and the "other" option active, if the user selects the "other" option the other input field shows.
But if the user then also selects another option, the "other" input field disappears despite remaining checked.


I suggest maybe adding !otherCheckbox.is(':checked') to the checkboxClickHandler function in form.all.js as shown below...
var checkboxClickHandler = function (e) {
var container = $(e.target).parents('[data-sf-role="checkboxes-field-container"]');
var checkboxes = container.find('input[data-sf-role="checkboxes-field-input"]');
var otherInput = $(container.find('[data-sf-checkboxes-role="other-choice-text"]').first());
var otherCheckbox = $(container.find('[data-sf-checkboxes-role="other-choice-checkbox"]').first());
var otherCheckboxIndex = checkboxes.index(otherCheckbox);
var currentIndex = checkboxes.index($(e.target));
var isRequired = container.find('[data-sf-role="required-validator"]').val() === 'True';
if (currentIndex == otherCheckboxIndex && otherCheckbox.is(':checked')) {
otherInput.attr('type', 'text');
if (isRequired)
otherInput.attr('required', 'required');
else
otherInput.removeAttr('required');
}
else if (!otherCheckbox.is(':checked')) { // Modified
otherInput.attr('type', 'hidden');
otherInput.removeAttr('required');
}
};
Using a Sitefinity MVC form with the Checkboxes control and the "other" option active, if the user selects the "other" option the other input field shows.
But if the user then also selects another option, the "other" input field disappears despite remaining checked.
I suggest maybe adding !otherCheckbox.is(':checked') to the checkboxClickHandler function in form.all.js as shown below...