Make email field a link
- Nikita Kurguzov
- Posts: 889
- Joined: Mon Jul 03, 2017
Hello, Jaydius!
It should happen on its own, you don't need to do anything special. If your text field contains a valid email address, when you open it in Read Only mode, it would automatically generate something like this:
You can check it in the browser's inspector. If this doesn't happen, let us know and post a screenshot, please.
It should happen on its own, you don't need to do anything special. If your text field contains a valid email address, when you open it in Read Only mode, it would automatically generate something like this:
Code: Select all
<a href="mailto:email@mail.com">email@mail.com</a>
Cheers
Good day Nikita,Nikita Kurguzov wrote: ↑09 Aug 2017Hello, Jaydius!
It should happen on its own, you don't need to do anything special. If your text field contains a valid email address, when you open it in Read Only mode, it would automatically generate something like this:You can check it in the browser's inspector. If this doesn't happen, let us know and post a screenshot, please.Code: Select all
<a href="mailto:email@mail.com">email@mail.com</a>
The field is a lookup from a contact list, where the personnel ID matches a contact list ID. The email address field is linked through to the Personnel listing. When displaying this lookup field on the Display form, it only shows it as text, not a link as you stated it should. I was hoping there would be a way to use the content (email address) to build a link from?
- Nikita Kurguzov
- Posts: 889
- Joined: Mon Jul 03, 2017
Yes, in case you are using Lookups instead of standard text field, it wouldn't generate this link automatically. Instead, it should generate links to the item itself. Are you saying it's only displaying lookup field as plain text? We need to know it in order to write appropriate code for your case.
Cheers
Correct, it's only displaying in plain text.Nikita Kurguzov wrote: ↑10 Aug 2017Yes, in case you are using Lookups instead of standard text field, it wouldn't generate this link automatically. Instead, it should generate links to the item itself. Are you saying it's only displaying lookup field as plain text? We need to know it in order to write appropriate code for your case.
- Nikita Kurguzov
- Posts: 889
- Joined: Mon Jul 03, 2017
Try using this code in JavaScript editor:
Sadly, we can't avoid using the Timer here. Replace FieldName with the internal name of the Email field.
Code: Select all
var myVar = setInterval(myTimer, 100);
function myTimer() {
var email = fd.field('FieldName').value();
if (email)
{
var string = "<a href=mailto:" + email + ">" + email + "</a>";
fd.field('FieldName').control()._el().html(string);
clearInterval(myVar);
}
}
Cheers
Works perfectly. Thank you very much for your help Nikita.Nikita Kurguzov wrote: ↑11 Aug 2017Try using this code in JavaScript editor:Sadly, we can't avoid using the Timer here. Replace FieldName with the internal name of the Email field.Code: Select all
var myVar = setInterval(myTimer, 100); function myTimer() { var email = fd.field('FieldName').value(); if (email) { var string = "<a href=mailto:" + email + ">" + email + "</a>"; fd.field('FieldName').control()._el().html(string); clearInterval(myVar); } }
-
- Information
-
Who is online
Users browsing this forum: No registered users and 4 guests