How to Insert Email links using Umbraco TinyMce

Add the below script inside the “script” tag in the \umbraco\plugins\tinymce3\insertLink.aspx page

function AppendProperty() {
var sText = $('#href').val();
if (validateEmail(sText)) {
$('#href').val(function (index, value) {
return 'mailto:' + value;
});
}
else {
if (sText != "" && (/^http/i.test(sText)) == false) {
$('#href').val(function (index, value) {
return 'http://' + value;
});
}
}
}

function validateEmail(sEmail) {
var filter = /^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
if (filter.test(sEmail)) {
return true;
}
else {
return false;
}
}

and modify the input field like the below

<input id="href" style="width: 220px;" type="text" name="href" value="" onchange="document.getElementById('localUrl').value = ''; selectByValue(this.form,'linklisthref',this.value);<strong> AppendProperty();"/>

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s