View Full Version : Want to import only email address with comma separated
nishant29
March 29th, 2007, 09:08 AM
Hi,
I have placed Plaxo widget for import addresses from other account and it working fine but I want to import only email addresses with comma separated.
Any solution ??
Help will be appriciated.
Thanks,
Nishant.
joseph
March 29th, 2007, 02:38 PM
Sure! There's a JavaScript function you can declare in your web page where you're hosting the widget button that will get called when the user chooses which names/emails to import. That function is passed all the name/email data as arrays, so you can just pull out the e-mails and stick them in your textfield. You still have to pass in a textarea/input ID to the widget to auto-fill, but you can use a hidden form field and just ignore it and use this function's output instead if that's what you want.
The function you need looks something like this:
function onABCommComplete(data) {
// called when user completes the widget; data is [[name1, email1], [name2, email2], ...]
var emails = [];
if (data) {
for (var i = 0; i < data.length; i++) {
emails.push(data[i][1]); // grab email and append it
}
}
var textField = document.getElementById('emails'); // replace with your destination field
textField.value = emails.join(', '); // join with commas
}
For another example of onABCommComplete, see http://www.plaxo.com/api/widget_demo and view source. Hope this helps. Let me know if you have any questions! js
haselhurst
October 11th, 2007, 12:03 AM
Hi Everyone,
I have Plaxo working on our website.
http://www.spaceandmotion.com/cgi-bin/pd/pd.cgi?image=/Images/albert-einstein-theory-1.jpg&title=Albert%20Einstein
However, I have spent the last two days trying to get Plaxo to only add email addresses separated by a comma.
I have read about 50 posts here, and have tried several options suggested (even installed firebug to my firefox to check java script). But it does not work - still just inputs both name and email address.
I really hope someone can help - as it is a useful tool, but at the moment it is useless as my postcard software does not recognize the standard email format it outputs (with name, and email address in < > brackets).
In terms of help I need more than just a reference to other related posts (I have read them all). But the exact code / changes that i need to add to get results modified into email addresses only, separated by a coma.
Would really (really) appreciate your help (as this is bugging me - why I cannot get it to work!).
Thanks,
Geoff Haselhurst
PS - We have one of the top philosophy sites on the internet, so you will get good publicity from our use of your widget.
http://www.alexa.com/browse?&CategoryID=304
(Alexa's list of top philosophy sites)
PPS - Other relevant posts on this.
http://forums.plaxo.com/showthread.php?t=3035
http://forums.plaxo.com/showthread.php?t=3863
http://forums.plaxo.com/showthread.php?t=3120
joseph
October 26th, 2007, 11:43 AM
Geoff-here's some exact code you can use. Follow the normal widget instructions and then add the following code into the page where you have the widget button (ideally inside the HEAD section, but anywhere should work). All you may have to change is the ID of the textarea you're displaying the list of emails in (if you don't call it "recipient_list" as we have in our instructions). The widget will call this code when the user has selected contacts and it will update the contents of the text area with just a comma-separated list of the email addresses and no names. Hope this helps! js
<script type="text/javascript"><!--
function onABCommComplete(data) {
// OPTIONAL: do something here when the new data gets populated in the text area
// data is an array of selected name/email arrays, i.e. [[name1, email1], [name2, email2], ...]
// collect just the emails
var emails = [];
for (var i = 0; i < data.length; i++) {
emails.push(data[i][1]);
}
// write the list of emails into the textarea (comma-separated)
var textAreaId = 'recipient_list'; // TODO: change this to whatever your textarea's ID is
document.getElementById(textAreaId).value = emails.join(', ');
}
//--></script>
vBulletin® v3.8.1, Copyright ©2000-2009, Jelsoft Enterprises Ltd.