turn a lookup filed to email clickable link
turn a lookup filed to email clickable link
hello friend,
i have a lookup in my table to a filed that contains an email address, i have managed to format the value of the filed to an Emil Link and it is working inside the lookup: is it possible to turn the text of the field outside to be clickable as well? shay.
i have a lookup in my table to a filed that contains an email address, i have managed to format the value of the filed to an Emil Link and it is working inside the lookup: is it possible to turn the text of the field outside to be clickable as well? shay.
Re: turn a lookup filed to email clickable link
Hi,
you can use javascript to change the text into a clickable text.
you can use javascript to change the text into a clickable text.
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.
Re: turn a lookup filed to email clickable link
OK, but where should i do it? in table-dv.js? can u please share an example?
thank you.
thank you.
Re: turn a lookup filed to email clickable link
Hi,
looking at the image you shared, yes, table-dv.js should work.
You may try something like
replace FIELDNAME with our valid fieldname
looking at the image you shared, yes, table-dv.js should work.
You may try something like
Code: Select all
$j('#FIELDNAME').wrap('<a id="FIELDNAME-mailto"><a>');
$j('#FIELDNAME-mailto').attr('href','mailto:'+$j('#FIELDNAME').text());
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.
Re: turn a lookup filed to email clickable link
Thanks, i tried it with my field name 'email3':
i even tried this in table.php in table_dv():
but no luck.
Code: Select all
$j('#email3').wrap('<a id="email3-mailto"><a>');
$j('#email3-mailto').attr('href','mailto:'+$j('#email3').text());
Code: Select all
<script>
$j(function() {
var email = $j("#email3").text().trim();
if (validateEmail(email)) {
var emailLink = $j("<a>").attr("href", "mailto:" + email).text(email);
$j("#email3").empty().append(emailLink);
}
});
function validateEmail(email) {
var re = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
return re.test(email);
}
</script>
Re: turn a lookup filed to email clickable link
Is your field email3 readonly on the page?
Do you see any error in the develper console?
The code in the table_dv looks a bit strange.
I quickly set up a test with
and it works fine.
Do you see any error in the develper console?
The code in the table_dv looks a bit strange.
I quickly set up a test with
Code: Select all
$j('#email3').wrap('<a id="email3-mailto"><a>');
$j('#email3-mailto').attr('href','mailto:'+$j('#email3').text());
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.
Re: turn a lookup filed to email clickable link
hi,
it is a lookup field , not read-only.
when i add the code you suggested , the email address disappear
it is a lookup field , not read-only.
when i add the code you suggested , the email address disappear
- Attachments
-
- 2023-05-18 214436.png (12.13 KiB) Viewed 2181 times
Re: turn a lookup filed to email clickable link
Hi,
well than it is a different story.
You may try
well than it is a different story.
You may try
Code: Select all
setTimeout(change_mail,1000);
function change_mail () {
$j('#email3').wrap('<a id="email3-mailto"><a>');
$j('#email3-mailto').attr('href','mailto:'+$j('#email3').text())
}
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.
Re: turn a lookup filed to email clickable link
excellent
thank you very much, it works .

thank you very much, it works .