You are viewing limited content. For full access, please sign in.

Question

Question

Get List of Attachments from Upload

asked on January 28, 2019

Bottom line, I'm trying to get the attachment filenames and put them in a "List of Attachments" variable separated by a "|":

I'm good with doing this on Submit but what I just tried did not work. Note that I'm also capturing date and time on Submit. Maybe I didn't put it in the right place? The upload button is q139 and the "List of Attachments" field is q162.

$(document).ready(function(){

//set fields to read only
  $(".read-only *").prop("readonly", true);

//Change background color for css = highlight
  $('.highlightYellow').css('background','#ffff99');

//Capture timestamp
  $('.Submit').click(timestamp);
 
  function timestamp() {
    
    var d = new Date();
    
    var minutes = d.getMinutes();
    var hours = d.getHours();
        
    var fullYear = d.getFullYear();
    var day = d.getDate();  //returns day as 1-31
    var month = d.getMonth() + 1;  //getMonth returns month as 0-11
    var fullDate = month + "/" + day + "/" + fullYear;
    
    var tz = new Date().getTimezoneOffset();
    var tzDiff = (tz/60);
    var utc = "(UTC-";
    if (tzDiff !== 0) {
      if (tzDiff.length = 1) {
        tzDiff = '0' + tzDiff;
        tzDiff += ':00';
      }
  	  utc += tzDiff > 0 ? '+' : '';
  	  utc += tzDiff + ")";
    }    
    
    if (minutes < 10) {var minutes = "0" + minutes;}
        
    if (d.getHours() < 12) {var a = "AM";}
	else if (d.getHours() == 12) {var a = "PM";}
	else {var a = "PM"; hours = hours - 12;}

    if ($(this).hasClass('Submit')) {
      $('.requisitionerDateSigned input').val(fullDate + " " + hours + ":" + minutes + " " + a + " " + utc)
    }
  document.getElementById('Field139').value = '';
  var attment = $('.ellipsis').attr('title');
    document.getElementById('Field139').value = attment;
  var fileName = document.getElementById('Field139').value;
    document.getElementById('Field162').value = fileName;
  };

});  //close document.ready

I'm pretty sure I'm close?!?!?!?

0 0

Replies

replied on February 5, 2019

Try something like this:

$('.ellipsis').map(function() {
  return $(this).attr('title');
}).get().join('|');

 

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.