[
https://issues.apache.org/jira/browse/CB-374?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13287280#comment-13287280
]
Olivier Louvignes commented on CB-374:
--------------------------------------
I haven't found how to successfully save a new Contact category, would you
please tell me if the code below is the correct way to do it? Thanks!
function onDeviceReady()
{
// do your thing!
//navigator.notification.alert("Cordova is working");
function onSuccess(contact) {
alert("Save Success");
};
function onError(contactError) {
alert("Error = " + contactError.code);
};
// create a new contact object
var contact = navigator.contacts.create();
contact.displayName = "Plumber";
contact.nickname = "Plumber"; //specify both to support
all devices
// populate some fields
var name = new ContactName();
name.givenName = "Jane";
name.familyName = "Doe";
contact.name = name;
// store contact phone numbers in ContactField[]
var phoneNumbers = [];
phoneNumbers[0] = new ContactField('work', '212-555-1234', false);
phoneNumbers[1] = new ContactField('mobile', '917-555-5432', false);
phoneNumbers[2] = new ContactField('perso', '203-555-7890', false);
contact.phoneNumbers = phoneNumbers;
var categories = [];
categories[0] = new ContactField('perso', 'perso', false);
contact.categories = categories;
// save to device
contact.save(onSuccess,onError);
}
> Be able to create new custom labels for our contacts fields.
> ------------------------------------------------------------
>
> Key: CB-374
> URL: https://issues.apache.org/jira/browse/CB-374
> Project: Apache Cordova
> Issue Type: Improvement
> Components: CordovaJS
> Reporter: Olivier Louvignes
> Assignee: Filip Maj
> Labels: contacts
> Fix For: 1.6.0
>
>
> It would be awesome to being able to create & set custom labels when updating
> a contact (like "pro", "perso", etc.)
> Unless i'm wrong, it is not possible today. Any chance of seing this soon?
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira