For the list archives, this was resolved by changing:

  alert(cursor.result['email']);

to

  alert(cursor.result.email[0].value);

After talking to reuben and gwagner on IRC it sounds like getting null when coercing the ContactField array to a string is a bug. It may get fixed a side-effect of converting to WebIDL. I'll file a bug to track it.

On 07/29/2013 09:59 AM, Ben Kelly wrote:
Hi Jose,

On 07/28/2013 06:01 PM, jose llopis wrote:
thats my problem. i use this code and only get null

Just to clarify, are you seeing "null" in your alert dialog for each
contact?

Are you able to view the email address in the stock contacts app?

var allContacts = navigator.mozContacts.getAll({});
     allContacts.onsuccess = function(event) {
       var cursor = event.target;
       if (cursor.result) {
                 if(cursor.result['tel']!=null)
                 {
                     $("#res").append((cursor.result['givenName']+" "
+cursor.result['familyName']+"<br/>"));
                     for(i=0;i<cursor.result['tel'].length;i++)
                     {
                         $("#res").append("telf:
"+(cursor.result['tel'][i].value)+"<br/>");
                     }
                     alert(cursor.result['email']);
                 }
         cursor.continue();
       } else {
         alert("No more contacts");
       }
     }

Also, be aware that givenName, familyName, and email are also arrays
just like the tel field.

Thanks.

Ben
_______________________________________________
dev-b2g mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-b2g
_______________________________________________
dev-b2g mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-b2g

Reply via email to