Please help us help you and fill where relevant:
Your LimeSurvey version:Version 3.27.14
Own server or LimeSurvey hosting: own server
Survey theme/template: bootswatch based
==================
Dear people, javascript and expression manager experts,
With the help of this forum I have built two jquery plugin. (credits go mostly to @tpartner and @jjofm pointing me to the solutions)
One to transform an array with text input to one with partly radioButtons
the other one should accompany it to do soft mandatory: Its working so far as it does stop the skipping and assigns a hidden non response
But what i am stuggeling with is to let the participants pass with the second click on next oder submit. Can somebody help me out pointing me in the right direction. I am suspecting that I need to fire the expressionManager somewhere to "register" the assigned values, but I couldnt figure out where
This is my soft mandatory plugin:
Code:
$.fn.specialArraySF = function(options){
var settings = $.extend({
},options);
return this.each(function() {
$('#ls-button-submit').on('click', function(e) {
var failTest = "";
$(' tr[id^="javatbd"]').each(function(i) {
if ($('td > input[type="text"]', this).val() === "") {
$(this).addClass('has-error');
failTest = 1;
$('th, td', this).css({'background':'#F39A8B'});
document.querySelector('#softmandatory-alert').style.visibility = "visible";
} else {
$(this).removeClass('has-error');
$('th, td', this).css({'background':'initial'});
}
});
if(failTest==1){
setTimeout(assignNonresponse(), 100);
e.preventDefault();
e.stopPropagation();
} else {
$('.exclusive-item input[type="text"]', thisRow).trigger('keyup');
}
});
function assignNonresponse(){
$(' tr[id^="javatbd"].has-error').each(function (i) {
$(this).removeClass("has-error");
$(".answer_cell_m97", this).each(function(i){
$("input[id$='_cbox']", this)[0].checked = true;
});
console.log($(".answer_cell_m97", this)[0].value);
// too early for expressionmanager $('.exclusive-item input[type="text"]', thisRow).trigger('keyup');
});
}
});
};
Thank you very much!