- Posts: 48
- Thank you received: 1
Ask the community, share ideas, and connect with other LimeSurvey users!
Please Log in to join the conversation.
Please Log in to join the conversation.
Please Log in to join the conversation.
<script type="text/javascript" data-author="Tony Partner"> $(document).on('ready pjax:scriptcomplete',function(){ $("#answer{SGQ}SQ001_SQ001").mask("999.999.999-99",{ placeholder:" " }); // Listener on the text input $('#answer{SGQ}SQ002_SQ002').on('keyup', function(e) { $(this).val($(this).val().toUpperCase()); checkconditions($(this).attr('value'), $(this).attr('name'), $(this).attr('type')); }); $("#answer{SGQ}SQ001_SQ002").val(" "); $("#answer{SGQ}SQ001_SQ002").hide(); // Identify the questions var qArrayID = '{QID}'; var qArray = $('#question'+qArrayID); var arrayLength = $('tr[id^="javatbd"]', qArray).length; var qUploads = qArray.nextAll('.upload-files:lt('+arrayLength+')'); // Add some classes qArray.addClass('array-with-uploads-question'); $(qUploads).addClass('d-none'); // Insert the "Upload" buttons $('tr[id^="javatbd"] .answer-item:last-child', qArray).each(function(i) { $('*', this).remove(); $(this).append('<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#upload-'+qArrayID+'-'+(i+1)+'" data-bs-backdrop="static" data-bs-keyboard="false">Anexar comprovante</button>'); }); // Loop through the upload questions $(qUploads).each(function(i) { // Create a modal $('body').append('<div class="modal fade upload-modal" id="upload-'+qArrayID+'-'+(i+1)+'" tabindex="-1" aria-labelledby="uploadModalLabel'+qArrayID+'-'+(i+1)+'" aria-hidden="true">\ <div class="modal-dialog">\ <div class="modal-content">\ <div class="modal-header">\ <h5 class="modal-title" id="uploadModalLabel'+qArrayID+'-'+(i+1)+'">'+$('.ls-label-question', this).html()+'</h5>\ <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Fechar"></button>\ </div>\ <div class="modal-body">\ </div>\ <div class="modal-footer">\ <button type="button" class="btn btn-primary" data-bs-dismiss="modal">OK</button>\ </div>\ </div>\ </div>\ </div>'); // Move this question into the modal $('#upload-'+qArrayID+'-'+(i+1)+' .modal-body').append($(this)); $(this).removeClass('d-none'); }); // Interrupt the Previous/Next/Submit function (to put upload questions back in the form) $('#limesurvey').on('submit', function(e) { $('.upload-modal .upload-files').appendTo($('.group-container:eq(0)')).addClass('d-none'); }); }); </script> <style data-author="Tony Partner" type="text/css"> .upload-modal .file-upload-modal.in { height: max-content; } </style>
Please Log in to join the conversation.