PDA

View Full Version : How do I make an Email link on a mobile ux component?


ABC123

kingcarol
07-20-2013, 10:54 AM
On a grid, it is easy to make a field with a Control Type of Link and then select 'Field value is an email address' in the Link Address type. This will call the user's email client and put the value in the field in the To line. I would like to do the same thing for an email field I have on my ux component for a mobile phone. How would you do this?

PhilM1965
07-20-2013, 01:04 PM
Hi Carol

What I did was this ... I changed the field type from textbox to label. I then added
text-decoration: underline; to the style of the field.

In the onclick event


var src = 'mailto:'+urlencode({dialog.object}.getValue('EMAILINFO'));
window.location.href = src;

where EMAILINFO is the field holding the email address.

It doesn't convert to a hover icon, but I am sure you could do that through CSS.

Hope that helps

Phil

PhilM1965
07-20-2013, 01:34 PM
For website links, I do the following ... just in case you or anyone else might need that at some point.

Again, I convert the field from textbox to label and use the same styling as above.


var src = 'http://'+urlencode({dialog.object}.getValue('WEBSITE'))+'';
window.open(src,'','');

where WEBSITE is the field containing the web address. It presupposes you store websites without the 'http://'

Hope that is useful too :smile:

Best wishes,

Phil

kingcarol
07-20-2013, 04:23 PM
Thank you SO MUCH, Phil. Your first post did the trick.

PhilM1965
07-20-2013, 04:29 PM
Hi Carol

The first post works for email, the second one would work for website url's just in case you ever need that!

Glad it helped out :smile:

Phil

gregincolumbus
07-27-2013, 10:50 AM
Phil,

I am trying this technique on a list control. I created a button and gave it a hide/show property if the EMAIL field is not blank. On the buttons "on click" event I put the code in you provided. When I test it, the email program does open, but it won't place the email address from the list control into the TO field of the new email.

Any suggestions on how I can make this work? A button seems like the best way to go on a mobile device....bigger target to hit!

Thanks

PhilM1965
07-28-2013, 06:57 AM
Hi Greg,

This should be pretty easy to do.

As an example, make a button and in the click event, use text mode and enter


window.open('mailto:test@example.com?subject=subject&body=body')

Does that get you near enough where you need to go? You can create the email address from your email field in the record and assign subject and body as you wish. You should also be able to do CC and BCC.

Have a look here down the page a bit where it says 'HTML links' http://www.w3schools.com/html/html_examples.asp

and there is also some good information here http://www.angelfire.com/dc/html-webmaster/mailto.htm

Regards,

Phil