adrianle Posted August 15, 2014 Share Posted August 15, 2014 So I have a client that wants me to add a function to her site that when she clicks a mailto href on a page to spawn an email child, some canned data chunk gets inserted into a form's textarea field.. something like: "Email sent to blah@blah.com on 8/14/14". I'm drawing a blank on how this might be handled.. any ideas out there?? Quote Link to comment https://forums.phpfreaks.com/topic/290473-a-strange-function/ Share on other sites More sharing options...
fastsol Posted August 15, 2014 Share Posted August 15, 2014 You're going to have to give a bit more to go on than that, it doesn't make much sense what you/her are asking. But I'm pretty sure you'll need a little javascript at minimum to block the default behavior action of the mailto href and possibly to place the text in the text field depending on how you want to achieve this. Quote Link to comment https://forums.phpfreaks.com/topic/290473-a-strange-function/#findComment-1487899 Share on other sites More sharing options...
ginerjm Posted August 15, 2014 Share Posted August 15, 2014 Things that make no sense. 1 - spawn an email child. 2 - click a mailto href 3 - insert.... into a form's textarea field (for what purpose?) How about telling us what you are trying to do? Quote Link to comment https://forums.phpfreaks.com/topic/290473-a-strange-function/#findComment-1487900 Share on other sites More sharing options...
cyberRobot Posted August 15, 2014 Share Posted August 15, 2014 Is this what you are looking for? <a href="mailto:somebody@gmail.com?body=Hello World">Sombody</a> If so, the following search results may help guide you further: https://www.google.com/#q=mailto%20populate%20message%20body Quote Link to comment https://forums.phpfreaks.com/topic/290473-a-strange-function/#findComment-1487903 Share on other sites More sharing options...
Barand Posted August 15, 2014 Share Posted August 15, 2014 Or maybe something like this? <!DOCTYPE html> <html> <head> <title>Sample</title> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> <script type='text/javascript'> function logEmail(name) { var dt = new Date(); var date = dt.toLocaleDateString(); var time = dt.toLocaleTimeString(); $("#ta").append("Email sent at "+date+" "+time+" to "+name+"\n" ); } $().ready(function(){ $(".mail").click(function(){ logEmail($(this).html()); }) }) </script> </head> <body> Mail: <a id='mail1' class='mail' href="mailto:john.doe@gmail.com">John Doe</a><br> Mail: <a id='mail2' class='mail' href="mailto:jane.doe@gmail.com">Jane Doe</a><br> <textarea id='ta' cols='60' rows='5'></textarea> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/290473-a-strange-function/#findComment-1487905 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.