asked on April 3, 2018

I have an Accident/Injury Form where a Safety Committee will review.  I used the following JavaScript to display the accident pictures in Laserfiche.  

How would I modify the JavaScript to display only 2 jpg's per page?

Thanks for any help!

$(document).ready(function () {

  displayUploadImage(true);

});

$(document).on('updatevalidation',function(){

  if($("input[name='IsLocked']").val() != 'True') {

    displayUploadImage(false);

  }

});

function displayUploadImage(isAll) {

    var host = window.location.hostname;

    var uqid = $('[name=uqid]').val();

    var iml = ['jpg','jpeg','gif','png'];

    var total= $('.files tbody .file').length;

    $('.files tbody .file').each(function(index) {

        if((isAll || index=== total-1) && !$(this).next('.image').length){

            if (($(this).find('a').length && $.inArray($(this).find('a').attr('title').match(/\.(\w{3,4})$/)[1],iml)>-1) ||

                ($(this).find('span').length && $.inArray($(this).find('span').text().match(/\.(\w{3,4})$/)[1],iml)>-1)){

              var aid = $(this).find('input').val();

              var ims = 'http://'+ host +'/Forms/handlers/downloadattachment.ashx?req=DownLoad&aid=' +aid +'&authkey=' + uqid,

                  imr = $('<img style="width:575px;" />');

              imr.attr('src',ims);

              $('<tr class="image"><td colspan=3>'+imr.prop('outerHTML')+'</td></tr>').insertAfter($(this));

            

            }

        }

    })

}
 

 

0 0