asked on April 2, 2019

Hi All,

 

I've built a table in forms which looks similar to below:

 

ItemCode      |         Description         |        Image in Database      |          Image Link

T01S4                       Steel Chair                                 Y                             http://LFServer/12313

HSJ1M                       Car door                                   Y                             http://LFServer/3214123

21JEX                    Steering Wheel                             N

 

This table is pre-filled via a lookup rule which will use generated web links to populate the Image link from workflow.

In my current solution, the Image Link field is shown all the time regardless. The code I'm using looks as below:

 

$(document).on("lookupcomplete",function(){

  $('.Link [type="text"]').each(function(e,el){
   var link=$(el).val();
   $(el).replaceWith($('<a href="'+ link +'" target="_blank">Image Link</a>'));
  });
}); 

Used from https://answers.laserfiche.com/questions/117062/how-to-hyperlink-the-single-line-field-in-table#117407

 

I need to make 2 changes to this code and I can't seem to get it right.

 

1) I need to only generate a link if "Image in Database" is set to Yes for that row. 

 

2) The actual table consists of many more columns, so much so that we need to hide some. I would like to create the hyperlink in the description column, and keep the description as is. Example output would look like:

 

ItemCode      |         Description                

T01S4                       Steel Chair                                                             

HSJ1M                       Car door                                                               

21JEX                    Steering Wheel               

 

Where description now is used to link direct to the document.

 

Any assistance would be greatly appreciated.

 

Thank you,

Aaron.             

 

 

2 0