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

Question

Question

Appending Custom Html Field in Collection

asked on January 23, 2018

Hi,

I have a collection in a LF Forms which populates entry ID for a laserfiche document based on a Single Field look up value.  I would like the entry id to be append to a custom html to create a link for weblink.

I have the code below.  the code works but the link only points to the first collection row.  I would like the link to show and append on each row as I have multiple rows.  I am little puzzled about using indexing on the target html field.

Can someone help me with this? 

Appreciate your help. 

$(document).on('blug change', '.InvEntyID_C input', entryIDtoHtml);
function entryIDtoHtml() {  
var i = 0;    
    $(".InvEntyID_C input").each(function() {      
      
    i++;   
      
    var doc_id5 = $('#Field154\\(' + i + '\\)').val(); // entry id of document
    var e = 'Field157'; //target html field
    var open5 = '&dbid=0&openfile="true"';
    var target5 = 'target="_blank"';//Add this in to get link to open in new tab
    var openLink5 = doc_id5 + open5; 
    var link5 = "<a " + target5 + "href=https://test.com/WebLink/ElectronicFile.aspx?docid=" + openLink5 +"'>View Invoice</a>";

          document.getElementById(e).innerHTML = link5;     
      });
  }

 

 

0 0

Answer

SELECTED ANSWER
replied on January 24, 2018

Hi Ajanthan,

If I understood it correctly, the field InvEntyID_C is the field used to keep the lookup result, and the custom HTML field is inside the collection as well, right?

Assuming that the custom HTML field has CSS class "customHTML", you can try script like this:

$(document).on('change', '.InvEntyID_C input', entryIDtoHtml);
  
function entryIDtoHtml() {
  var doc_id5 = $(this).val(); // entry id of document
  var customHTML = $(this).closest('div.form-q').find('.customHTML .cf-custom');

  var open5 = '&dbid=0&openfile="true"';
  var target5 = 'target="_blank"';//Add this in to get link to open in new tab
  var openLink5 = doc_id5 + open5; 
  var link5 = "<a " + target5 + "href=https://test.com/WebLink/ElectronicFile.aspx?docid=" + openLink5 +"'>View Invoice</a>";
  customHTML.html(link5);
}

 

0 0
replied on January 25, 2018

Thank You Rui.  Your script is working.  Thanks for your help.

 

AJ

 

0 0

Replies

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

Sign in to reply to this post.