Make an email link

Folks

Is there a way of doing this?

I have a form where the user grabs the entry they are looking for from a DB Join element, then there are 2 more CDD element that grab the corresponding information one of which is an email address

Is there a way of displaying a link that says "Email Agent" as opposed to showing the email address. I have tried a display element with the following as the default value

<a href="mailto:{landlord___agentemail}">Email Agent</a>

&

<a href="mailto:{___agentemail}">Email Agent</a>

But neither are working

Thanks for any guidance

Regards
 
Have you tried with a calc element?

PHP:
$email = '{landlord___agentemail}';
return '<a href="mailto:'.$email.'">Email Agent</a>';
 
Thanks JFQ - that didn't work - don't worry I'll have it as I have it at the moment with an email address which is not clickable
 
JFQ's suggestion should work. Works for me, I've used that same way building mailto links many times.

-- hugh
 
Thanks guys - I have tried all sort of combinations but the link it returns is

mailto:{landlord__agentemail}

Not to worry I'll leave it as it is

Thanks anyway

Regards
 
You might want to check your code in the Calc element. I noticed an issue recently that HTML is being stripped from the PHP code if the calc or related elements are re-saved. Which might explain your results.
 
BTW, the code is retained if you Save and Close. It is only stripped if you open and save the Calc element or I think if you open and save an element that is used in the code.

So my workaround was to keep a copy of my code to paste in whenever an edit was needed.
 
Thanks Rackem - I have a DB Join which feeds 2 other CDD elements and the email is in one of those CDD's (Where I have also tried using Cal element as well)

Is it the DB Join that is causing the problem?
 
Can one of you please give a more detailed description of HTML code being stripped from calc so someone can investigate?

Also, have you checked the database to see what is saved to confirm whether it is a save problem or a recall problem?

Thx.

S
 
Sophist

It could be a side effect - When I add the code it is there until I go to edit it and all I see is the line count with no code?

On another note, with the very kind help of Kinkaz the emails are now converted by using some JavaScript :)
 
In case anybody has this problem :

The field lazysheepmedia is using is a dbjoin, so it was not possible to have a calc element. I figured the best way to deal with it was to add some javascript (the element was read-only, just to display some info like in a list). The code is following :

var j = jQuery.noConflict();
var email = j('#___CTenant_UEMAIL div').html(); // div containing the email
j('#___CTenant_UEMAIL div').html('<a href="mailto:'+email+'">Email Agent</a>');
 
It was a side-effect of switching to the fancy code editor. I have fixed it and made a few improvements to the appearance. PR-921 - it may be a day or two before this is merged into the gitHub master.
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top