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

Question

Question

Forms 10 - URI from Lookup

asked on December 15, 2015 Show version history

Hi,

I'm currently populating a Forms table with values from a lookup. Specifically - one of the values I'm retrieving is a URI that I'd like to be clickable for the user. Is there a way that I can achieve this using JavaScript or any other methods?

0 0

Replies

replied on December 15, 2015

You can hide the Input tag and put a href attribute with the value in Input 

0 0
replied on December 16, 2015

Hi Abby,

Would you be able to go into a little more detail about your solution? I'm using the following method at the moment but it only appears as a link after the form has been submitted?

  $('.links').each(function(){
        var str = $(this).html();
        var regex = /(\b(https?|ftp):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/gim;
        var replaced_text = str.replace(regex, "<a href='$1' target='_blank'>Link</a>");
        $(this).html(replaced_text);
    });

 

0 0
replied on December 16, 2015

When this function get triggered. So you may want to have an onchange trigger on the input field, when there's a change in the value, the links' content get updated.

0 0
replied on December 17, 2015

I've done some more testing with this and the functionality works when the task is viewed by a different user than who is assigned.

However when the form is viewed by the assigned user they are presented with an input box with the HTML as the value.

Is there a way I can force the input box to be disabled and viewed as it is from a non-assigned user?

Hope the above makes sense.

0 0
replied on December 17, 2015 Show version history

Hi there, you can try this

1. setup lookup return just the url (http://localhostxxxx) in the Link input column, hide this Link input html attribute using javascript

2. insert a href html attribute next to the Link input html attribute, and render the Link value.

The problem of your script is not who is viewing it, is the trigger time, when the link each get triggered, there's no value in the Link input box yet. So you need to do a trigger on change of the Link column input.

0 0
replied on December 17, 2015

How do I add a Custom HTML field into a table?

My javascript is triggering on document.ready() - it's using regular expression to change the URI http://localhost... to a html anchor tag.

0 0
replied on December 17, 2015 Show version history

Sorry Ronald, I updated my answer above. You don't use customhtml field, you need to insert that element to HTML using javascript.

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

Sign in to reply to this post.