Confirmed users
120
edits
Line 36: | Line 36: | ||
Update contact example: | Update contact example: | ||
// "contact" is the same contact object as in the save example above. The contact must have | // "contact" is the same contact object as in the save example above. The contact must have its ID field set to update it. | ||
// Note that when updating array fields (like telephones) all the phone numbers must be specified, not just the one you want to update. | // Note that when updating array fields (like telephones) all the phone numbers must be specified, not just the one you want to update. | ||
contact.tel = [{type: ["home"], value: "8675309", carrier: "myCarrier", pref: 1}, {type: ["home", "custom type"], value: "1234567", pref: 0}]; | contact.tel = [{type: ["home"], value: "8675309", carrier: "myCarrier", pref: 1}, {type: ["home", "custom type"], value: "1234567", pref: 0}]; | ||
Line 51: | Line 51: | ||
Remove/delete contact example: | Remove/delete contact example: | ||
// "contact" is the same contact as in the create and update examples. A contact object must have | // "contact" is the same contact as in the create and update examples. A contact object must have its ID property set in order to remove it. | ||
var request = navigator.mozContacts.remove(contact); | var request = navigator.mozContacts.remove(contact); | ||