Is it possible to turn user input on a String field into a clickable link that displays on the form?

Shant Cancik
Tera Contributor

This is a bit of a strange requirement but I need to figure out a way to take a string that a user enters into a string field and then turn it into a clickable link for them.

My initial thought process for how I'd do this is to create two fields : 

1) Value field (String)

2) Created Link field (String and set to read only)

 

I then use an onChange client script to take the string entered in the value field and add it to the end of the URL given to me from my client (I'll use "www.website.com/" as an example for now).

So... if the user entered "test" then my ceated link field would display "www.website.com/test" .

 

This will work but is there any way to do this and also have the link clickable? Maybe my initial idea for how to do this isn't ideal?

 

Thanks for any input!

1 ACCEPTED SOLUTION

shawna
Tera Guru

Change Created Link Field from text field to html field rather. In client script, when creating the link, create links with <a href="url"></a>, try something like this:

for (i=0; i<arr.length; i++) {


var url = "<a href="https://www.website.com/" + arr[i] + "></a> ";

g_form.setValue('u_created_link_field", url);

}

 

View solution in original post

8 REPLIES 8

skype support
Kilo Explorer

The URL field should be hidden and it comes after only the string is completed and then the URL field will open and the attachment of both like clickable link will appear on the module. This can be helpful if have any problem contact skype support

shawna
Tera Guru

Change Created Link Field from text field to html field rather. In client script, when creating the link, create links with <a href="url"></a>, try something like this:

for (i=0; i<arr.length; i++) {


var url = "<a href="https://www.website.com/" + arr[i] + "></a> ";

g_form.setValue('u_created_link_field", url);

}

 

Hi Shawna,

 

This was a clever idea thank you but unfortunately now nothing populates in the Created Link html field. If I have my Created Link field as a string I get the values to appear but as an HTML nothing happens 😕

 

I can't get anything to show up when trying to g_form.setValue to that HTML field. Is it possible to do it?

 

-Shant

Nevermind! I got it to display by playing around with the html value I was using. Thanks so much!!