- Posts: 57
- Thank you received: 3
Ask the community, share ideas, and connect with other LimeSurvey users!
<script type="text/javascript" charset="utf-8"> $(document).ready(function() { // Identify this question var thisQuestion = $('#question{QID}'); // Assign column-specific classes $('table.subquestions-list tr', thisQuestion).each(function(i){ $('> *', this).each(function(i){ $(this).addClass('column-'+i+''); $(this).attr('data-column', i); }); }); // Define the column to have exclusive answers var exclusiveColumn = 4; // Listeners on the radios $('input.radio', thisQuestion).on('click', function(e) { var thisCell = $(this).closest('td'); if($(thisCell).hasClass('column-'+exclusiveColumn)) { setTimeout(function () { $('.column-'+exclusiveColumn+' input.radio:not(:checked)', thisQuestion).prop('disabled', true); }, 100); } if($('.column-'+exclusiveColumn+' input.radio:checked', thisQuestion).length == 0) { $('.column-'+exclusiveColumn+' input.radio', thisQuestion).prop('disabled', false); } }); // Initial radio state if($('.column-'+exclusiveColumn+' input.radio:checked', thisQuestion).length != 0) { $('.column-'+exclusiveColumn+' input.radio:not(:checked)', thisQuestion).prop('disabled', true); } }); </script>
countif("d",self.NAOK) <= 1
Denis, is that a custom validation for making sure that at the whole question option "d" is used only once?DenisChenu wrote: ANd with EM (for PHP validation too (user deactivated javascript)
Question validation equationCode:countif("d",self.NAOK) <= 1
YesMazi wrote: ....
Denis, is that a custom validation for making sure that at the whole question option "d" is used only once?
Sure, but : need a PHP control . Else a user can decativate JS (or js can be broken for some reason ) and false value in DB.tpartner wrote: Yeah but I think the user experience with disabled radios is better.