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

Question

Question

Hyperlink Table Item

asked on May 2, 2023 Show version history

Hi all,

 

I'm stuck with trying to get a table item as a hyperlink.

I am following this very handy post by Jason 

https://answers.laserfiche.com/questions/183380/make-text-box-a-hyperlink

I do get a link hover icon, however when I click the link nothing is happening. I am using Chrome and in classic designer on 11.2. 

 

I was also curious if I its possible to use a variable with that link to pass it to a query string to open up a new form.

I currently put https://www.news.com.au in my table to try and get the link working

 

Any help appreciated

1 0

Answer

SELECTED ANSWER
replied on May 3, 2023

Here's one possibility. 

This would replace the CSS and Javascript used from the other post.  In this case, you don't need the CSS to make the text look like a link, because it's using an actual link.  This Javascript loops through each row of the table when the form is loaded or changes are made to the table.  It creates links to the right of the urlColumn field, and then hides the urlColumn field.

It is still dependant on the urlColumn field having the complete URL for the link, using the formulas, etc.

$(document).ready(function(){
  
  //Run the createTableLinks function on form load and table changes.
  createTableLinks();
  $('.myTable').on('change', createTableLinks);
  
  //Function that creates links from the urlColumn on each row of the table.
  function createTableLinks() {
    $('.generatedLink').each(function() {
      $(this).remove();
    });
    $('.urlColumn input').each(function() {
      var myURL = $(this).val();
      $(this).after('<a href="' + myURL + '" target="_blank" class="cf-field generatedLink" style="font-size: 16px;">Click Here</a>');
      $(this).hide();
    });
  }
  
});

 

2 0

Replies

replied on May 2, 2023 Show version history

Note - you are probably referring to Forms 11 Update 2, not 11.2 - these are not dot releases, but updates to 11.0.  If you go to Help > About in Forms you can see the specific version, which will probably be something like this:   11.0.2201.20436    Which basically says version 11.0, update #20436, which was initially released in January 2022.

The post you linked to really only has a couple requirements to work.  I just tested it on version 11.0.2212.30987 and it worked, so I'm wondering if you may be missing a needed piece, such as the class name on the table.

  1. You need a table that has class name of myTable.
  2. In that table, you need a single line field that has class name of urlColumn.
  3. That single line field needs a URL in the text of the field.

 

As far as including variables in the URL to open another LFForm process, that should work.  Let's say you have a process whose url is https://MYFORMSSERVERURL/Forms/Test and that process has a field on it with variable test_field.  You can populate that variable with the text "Test Value" via the URL, like this: https://MYFORMSSERVERURL/Forms/Test?test_field=Test%20Value (note that %20 is used instead of spaces in URLs).  You can do populate multiple fields, just separate each one by an & symbol, like this: https://MYFORMSSERVERURL/Forms/Test?test_field=Test%20Value&test_field2=Test%20Value%202&test_field3=Test%20Value%203  which will populate "Test Value" into test_field, "Test Value 2" into test_field2, and "Test Value 3" into test_field3.

2 0
replied on December 7, 2023

This worked great for me.  Thanks for posting!!!

2 0
replied on May 2, 2023

Try using CONCATENATE to create your URL

=CONCATENATE("http://www,mysiteurl.com?room_id=“,INDEX(Table_1.Column_1,ROW()))

1 0
replied on May 3, 2023

That worked a treat! Thank you, I can use this in so many places

Pushing my luck now

Just to make it look nice, is there a way to 'mask' the link, currently its the full URL but I'd love to be able to mask it with some text like "click here"?

 

0 0
SELECTED ANSWER
replied on May 3, 2023

Here's one possibility. 

This would replace the CSS and Javascript used from the other post.  In this case, you don't need the CSS to make the text look like a link, because it's using an actual link.  This Javascript loops through each row of the table when the form is loaded or changes are made to the table.  It creates links to the right of the urlColumn field, and then hides the urlColumn field.

It is still dependant on the urlColumn field having the complete URL for the link, using the formulas, etc.

$(document).ready(function(){
  
  //Run the createTableLinks function on form load and table changes.
  createTableLinks();
  $('.myTable').on('change', createTableLinks);
  
  //Function that creates links from the urlColumn on each row of the table.
  function createTableLinks() {
    $('.generatedLink').each(function() {
      $(this).remove();
    });
    $('.urlColumn input').each(function() {
      var myURL = $(this).val();
      $(this).after('<a href="' + myURL + '" target="_blank" class="cf-field generatedLink" style="font-size: 16px;">Click Here</a>');
      $(this).hide();
    });
  }
  
});

 

2 0
replied on May 3, 2023

Thanks Matthew for taking the time to explain, that is really helpful!

 

This is a good solution and I have it working now!

 

Very much appreciated!

1 0
replied on May 2, 2023

Hi Matthew,

Thanks very much for your help. I keep forgetting about the version numbers!

Ahhh, yes I had mytable as the class for the table not myTable!!! Working great, thank you!

 

I'm very close to getting my query string working. Based on what you mention, how can I add the value of the current row of my table, column 1, as the variable to pass on.

Currently I can create a formula to reference it in column 2 to try and combine it into the url, but the part I am stuck on is how to add that to the URL. I'm trying - "http://www,mysiteurl.com?room_id=INDEX(Table_1.Column_1,ROW())"

in the hopes of prepopulating a field in another form called room_id, which will filter a lookup.

Would another way to be to try and add the reference to the Column 1 in the Javascript?

Thanks!

 

 

 

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

Sign in to reply to this post.