Please help us help you and fill where relevant:
LimeSurvey version: 6.13.2
Own server or LimeSurvey Cloud: Own Hosted
Survey theme/template: Custom based on Vanilla
==================
Hi there
We have used the following plugin [url]
gitlab.com/SondagesPro/QuestionSettingsType/checkboxForText
[/url] kindly provided by @Denis for almost all our projects but since upgrading to version 6 it is no longer working, I have changed the compatibility version number in the XML file and it installs but it throws an error when loading the page.
Is there a version or an alternative to adding a Don't know button to open ended text boxes and numeric entry questions (note we run our surveys in question by question display so the manipulation of group by group wouldn't help)
Hopefully this is something that is easy to do or the plugin has a new home and has been updated.
Many thanks as always for your time
Dave
Update :
I have managed to do this by adding the following script .. whilst not as elegant as the plugin it works and adds -99 to the answer for numeric and don't know selected for short and long text questions and allows for submission on mandatory questions
// Identify this question ID
var qID = '{QID}';
// Select the input or textarea using its question ID
var inputElements = $('#question' + qID + ' input[type="text"], #question' + qID + ' textarea, #question' + qID + ' input[type="number"]');
// Check if input or textarea elements were found
console.log("Input elements count: " + inputElements.length);
if (inputElements.length > 0) {
inputElements.each(function() {
var element = $(this);
if (element.hasClass('numeric')) {
console.log("Numeric entry found");
} else {
console.log("Text entry found");
}
});
// Create a new div for the checkbox
var dontKnowDiv = $('<div style="margin-top: 10px;"></div>');
// Create the checkbox element
var dontKnowCheckbox = $('<label><input type="checkbox" id="dontKnowCheckbox" style="opacity: 1; visibility: visible;"> Don\'t know</label>');
// Append the checkbox to the new div
dontKnowDiv.append(dontKnowCheckbox);
// Append the new div after the input field or textarea
inputElements.closest('div').after(dontKnowDiv);
console.log("Checkbox added");
// Handle the event when the "Don't know" checkbox is clicked
$('#dontKnowCheckbox').change(function() {
inputElements.each(function() {
var element = $(this);
if ($('#dontKnowCheckbox').is(':checked')) {
if (element.hasClass('numeric')) {
// Populate numeric input with -99
element.val(-99);
} else {
// Populate text input or textarea with specific text
element.val('Don\'t know option selected');
}
element.css('color', 'transparent'); // Hide text
} else {
// Restore the original visible value if unchecked
element.css('color', '');
element.val(element.data('visibleValue') || '');
}
});
});
// Store the visible value on focus-out for each element
inputElements.on('blur', function() {
var element = $(this);
if (!$('#dontKnowCheckbox').is(':checked')) {
element.data('visibleValue', element.val());
}
});
} else {
console.log("Input or textarea not found");
}