- Posts: 10109
- Thank you received: 3595
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Upload modal - Strange behavior after upgrade to version 5
- tpartner
- Away
- LimeSurvey Community Team
Less
More
1 year 8 months ago #231260
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Upload modal - Strange behavior after upgrade to version 5
What happens when testing with the vanilla theme?
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Please Log in to join the conversation.
- squidy
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 41
- Thank you received: 1
1 year 8 months ago #231261
by squidy
Using LS 5.x
Replied by squidy on topic Upload modal - Strange behavior after upgrade to version 5
Same thing with vanilla theme...
Using LS 5.x
Please Log in to join the conversation.
- tpartner
- Away
- LimeSurvey Community Team
Less
More
- Posts: 10109
- Thank you received: 3595
1 year 8 months ago #231289
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Upload modal - Strange behavior after upgrade to version 5
Can you attach a sample survey (.lss file) containing only the relevant question(s).
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Please Log in to join the conversation.
- squidy
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 41
- Thank you received: 1
1 year 8 months ago #231303
by squidy
Using LS 5.x
Replied by squidy on topic Upload modal - Strange behavior after upgrade to version 5
Sure.. The file is attached.
Using LS 5.x
Attachments:
Please Log in to join the conversation.
- tpartner
- Away
- LimeSurvey Community Team
Less
More
- Posts: 10109
- Thank you received: 3595
1 year 8 months ago #231325
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Upload modal - Strange behavior after upgrade to version 5
Your image above does not resemble the attached sample survey. I cannot reproduce the problem in that survey using the vanilla theme.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Please Log in to join the conversation.
- squidy
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 41
- Thank you received: 1
1 year 8 months ago #231326
by squidy
Using LS 5.x
Replied by squidy on topic Upload modal - Strange behavior after upgrade to version 5
Hmm..
I noticed that the problem only happens when I activate the hideEmptyColumn plugin... Disabling hideEmptyColumn works, but I don't want the radio button in the question
I noticed that the problem only happens when I activate the hideEmptyColumn plugin... Disabling hideEmptyColumn works, but I don't want the radio button in the question
Using LS 5.x
Please Log in to join the conversation.
- tpartner
- Away
- LimeSurvey Community Team
Less
More
- Posts: 10109
- Thank you received: 3595
1 year 8 months ago - 1 year 8 months ago #231331
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Upload modal - Strange behavior after upgrade to version 5
If you don't want radio buttons, use an array-texts type question.
- manual.limesurvey.org/Question_type_-_Array_(Texts)/en
- manual.limesurvey.org/Question_type_-_Array_(Texts)/en
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 1 year 8 months ago by tpartner.
Please Log in to join the conversation.
- tpartner
- Away
- LimeSurvey Community Team
Less
More
- Posts: 10109
- Thank you received: 3595
1 year 8 months ago #231332
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Upload modal - Strange behavior after upgrade to version 5
Here is an example of the code required to insert "Upload" buttons into an array-texts type question:
Sample survey attached:
Code:
<script type="text/javascript" data-author="Tony Partner"> $(document).on('ready pjax:scriptcomplete',function(){ // 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('hidden'); // 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-backdrop="static" data-keyboard="false">Anexar comprovante</button>'); }); // Loop through the upload questions $(qUploads).each(function(i) { // Create a modal $('body').append('<div class="modal upload-modal" id="upload-'+qArrayID+'-'+(i+1)+'" tabindex="-1" role="dialog">\ <div class="modal-dialog" role="document">\ <div class="modal-content">\ <div class="modal-header">\ <h5 class="modal-title">'+$('.ls-label-question', this).html()+'</h5>\ </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('hidden'); }); // Interrupt the Next/Submit function (to put upload questions back in the form) $('#ls-button-submit').on('click', function(e) { $('.upload-modal .upload-files').appendTo($('.group-container:eq(0)')).addClass('hidden'); }); }); </script>
Sample survey attached:
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Please Log in to join the conversation.
- squidy
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 41
- Thank you received: 1
1 year 8 months ago #231333
by squidy
Using LS 5.x
Replied by squidy on topic Upload modal - Strange behavior after upgrade to version 5
Very nice.. So thanks, Tony.
Using LS 5.x
Please Log in to join the conversation.
- squidy
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 41
- Thank you received: 1
1 year 7 months ago #231672
by squidy
Using LS 5.x
Replied by squidy on topic Upload modal - Strange behavior after upgrade to version 5
Hi Tony...
Everything is working fine, except when the participant saves the files in this modal and goes back to a page before this question. When he comes back to this question page again, the files are gone (not saved).
Everything is working fine, except when the participant saves the files in this modal and goes back to a page before this question. When he comes back to this question page again, the files are gone (not saved).
Using LS 5.x
Please Log in to join the conversation.
- tpartner
- Away
- LimeSurvey Community Team
Less
More
- Posts: 10109
- Thank you received: 3595
1 year 7 months ago #231736
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Upload modal - Strange behavior after upgrade to version 5
This script will fix that bug:
Sample survey attached:
Code:
<script type="text/javascript" data-author="Tony Partner"> $(document).on('ready pjax:scriptcomplete',function(){ // 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('hidden'); // 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-backdrop="static" data-keyboard="false">Anexar comprovante</button>'); }); // Loop through the upload questions $(qUploads).each(function(i) { // Create a modal $('body').append('<div class="modal upload-modal" id="upload-'+qArrayID+'-'+(i+1)+'" tabindex="-1" role="dialog">\ <div class="modal-dialog" role="document">\ <div class="modal-content">\ <div class="modal-header">\ <h5 class="modal-title">'+$('.ls-label-question', this).html()+'</h5>\ </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('hidden'); }); // Interrupt the Previous/Next/Submit function (to put upload questions back in the form) $('#ls-button-previous, #ls-button-submit').on('click', function(e) { $('.upload-modal .upload-files').appendTo($('.group-container:eq(0)')).addClass('hidden'); }); }); </script>
Sample survey attached:
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Please Log in to join the conversation.
- squidy
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 41
- Thank you received: 1
1 year 7 months ago #231750
by squidy
Using LS 5.x
Replied by squidy on topic Upload modal - Strange behavior after upgrade to version 5
It worked.. Thank you very much Tony..
Using LS 5.x
Please Log in to join the conversation.