- Posts: 6
- Thank you received: 0
Ask the community, share ideas, and connect with other LimeSurvey users!
Please Log in to join the conversation.
<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>
Please Log in to join the conversation.
Please Log in to join the conversation.
Please Log in to join the conversation.
Please Log in to join the conversation.
Please Log in to join the conversation.
Please Log in to join the conversation.
Please Log in to join the conversation.
Please Log in to join the conversation.
Please Log in to join the conversation.