- Posts: 13
- Thank you received: 0
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.
Please Log in to join the conversation.
Please Log in to join the conversation.
/* LINK ON UPLOADED FILES */ function updateLink(element) { let jsonValue = $(element).attr('value'); let fieldname = $(element).attr('name').replace("java",""); let afieldname = fieldname.split("X"); let dataUpload = jQuery.parseJSON( jsonValue ); let url = "/index.php?r=uploader/index?sid=" + afieldname[0] +"&fieldname=" + fieldname + "&qid=" + afieldname[2] + "&filegetcontents="; if(typeof dataUpload == 'object') { table = $(element).closest(".upload-files.question-container").find(".ls-answers table.uploadedfiles"); $.each(dataUpload, function( index, uploaded ) { let link = url + uploaded.filename; let cell = $(table).find("tbody tr").eq(index).find('td.edit'); let filename = $(cell).text(); $(cell).off('click'); $(cell).html("<a href='" + link + "' target='_blank' download='" + filename + "'>" + filename + "</a>"); }); } } $(document).on('ready',function(){ $(".upload-item :hidden:first").each(function(){ var element = $(this); setTimeout(function() { updateLink($(element)); }, 500); }); }) $(document).on("updated",".upload-item :hidden:first",function(event){ var element = $(this); setTimeout(function() { updateLink($(element)); }, 500); });
Please Log in to join the conversation.