- Posts: 6
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
File Upload Title
- manoeuvre
- Topic Author
- Offline
- New Member
Less
More
10 months 3 weeks ago #244401
by manoeuvre
File Upload Title was created by manoeuvre
Please Log in to join the conversation.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10121
- Thank you received: 3599
10 months 3 weeks ago #244466
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 File Upload Title
You can create a custom question theme based on the core file upload question and add something like this to the end to the answer.twig file in that theme:
Code:
<script type="text/javascript" data-author="Tony Partner"> $(document).on("ready pjax:scriptcomplete", function(){ var qID = "{{fileid}}".split('X')[2]; var thisQuestion = $('#question'+qID); // A function to insert a dropdown for the upload title input function insertTitleSelect() { var titleLabels = $('.file-upload-modal label[for^="{{fileid}}_title"]', thisQuestion); if(titleLabels.length > 0) { $.each(titleLabels, function(i, thisLabel) { var thisRow = $(thisLabel).closest('.form-group'); $(':text:eq(0)', thisRow).hide(); if($('.inserted-select', thisRow).length == 0) { thisRow.append('<select class="inserted-select form-control"><option value="">{{ gT("Please choose...") }}</option>\ <option value="Title 1">Title 1</option>\ <option value="Title 2">Title 2</option>\ <option value="Title 3">Title 3</option>\ <option value="Title 4">Title 4</option>\ </select>'); if($(':text:eq(0)', thisRow).val() != '') { $('.inserted-select', thisRow).val($.trim($(':text:eq(0)', thisRow).val())); } $('.inserted-select', thisRow).on('change', function(e) { $(':text:eq(0)', thisRow).val($('.inserted-select', thisRow).val()); }); } }); } } // Place an observer on the upload modal element to detect DOM changes var observer = new MutationObserver(function(e) { insertTitleSelect(); }); var $fileUploadModal = $('.file-upload-modal', thisQuestion); observer.observe($($fileUploadModal)[0], { attributes: true,childList: true, subtree: true }); }); </script>
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: manoeuvre
Please Log in to join the conversation.
- manoeuvre
- Topic Author
- Offline
- New Member
Less
More
- Posts: 6
- Thank you received: 0
10 months 3 weeks ago - 10 months 3 weeks ago #244469
by manoeuvre
Replied by manoeuvre on topic File Upload Title
Thanks for your answer.
How do I exactly do this in Version 6x ?
How do I exactly do this in Version 6x ?
Last edit: 10 months 3 weeks ago by manoeuvre.
Please Log in to join the conversation.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10121
- Thank you received: 3599
10 months 3 weeks ago - 10 months 3 weeks ago #244476
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 File Upload Title
Here is some documentation on custom question themes -
github.com/LimeSurvey/LimeSurvey/tree/master/themes/question
Feel free to copy some of these for inspiration - github.com/tpartner?tab=repositories
Feel free to copy some of these for inspiration - github.com/tpartner?tab=repositories
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 10 months 3 weeks ago by tpartner.
Please Log in to join the conversation.
- manoeuvre
- Topic Author
- Offline
- New Member
Less
More
- Posts: 6
- Thank you received: 0
10 months 3 weeks ago #244478
by manoeuvre
Replied by manoeuvre on topic File Upload Title
Thank you, sorry for asking you for multiple questions.
But I've upgraded to version 6.x an the script above didn't work.
Can you please giving the new code ?
But I've upgraded to version 6.x an the script above didn't work.
Can you please giving the new code ?
Please Log in to join the conversation.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10121
- Thank you received: 3599
10 months 3 weeks ago #244482
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 File Upload Title
As you neglected to give the details of your LimeSurvey installation in the opening post, my workaround was developed for 5.x.
I will look into it next week as time allows.
I will look into it next week as time allows.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: manoeuvre
Please Log in to join the conversation.
- manoeuvre
- Topic Author
- Offline
- New Member
Less
More
- Posts: 6
- Thank you received: 0
10 months 3 weeks ago #244484
by manoeuvre
Replied by manoeuvre on topic File Upload Title
Thanks, your responses very much appreciated
Please Log in to join the conversation.
- manoeuvre
- Topic Author
- Offline
- New Member
Less
More
- Posts: 6
- Thank you received: 0
10 months 2 weeks ago #244805
by manoeuvre
Replied by manoeuvre on topic File Upload Title
Any updates ?
Please Log in to join the conversation.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10121
- Thank you received: 3599
10 months 2 weeks ago #244809
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 File Upload Title
I have not been able to get it to work on 6.x.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: manoeuvre
Please Log in to join the conversation.
- manoeuvre
- Topic Author
- Offline
- New Member
Less
More
- Posts: 6
- Thank you received: 0
10 months 1 week ago #244914
by manoeuvre
Replied by manoeuvre on topic File Upload Title
Finally I can figure it out! Just change .form-group to .mb-3 from the script above.
Thank you!
Thank you!
Please Log in to join the conversation.