Note that there are some explanatory texts on larger screens.

plurals
  1. POUncaught ReferenceError: ContactFindOptions is not defined
    text
    copied!<p>I have a problem with cordova/phonegap contacts.<br> This is the code i am trying to execute, i put in an external javascript file:</p> <pre><code>function onDeviceReady() { // find all contacts var options = new ContactFindOptions(); options.filter = "*"; var fields = ["displayName", "name"]; navigator.contacts.find(fields, onSuccess, onError, options); } // onSuccess: Get a snapshot of the current contacts function onSuccess(contacts) { for (var i = 0; i &lt; contacts.length; i++) { console.log("Display Name = " + contacts[i].displayName); } } // onError: Failed to get the contacts function onError(contactError) { alert('onError!'); } </code></pre> <p>This is the code from the phonegap API documentation: <a href="http://docs.phonegap.com/en/edge/cordova_contacts_contacts.md.html#contacts.find" rel="nofollow"></a> <a href="http://docs.phonegap.com/en/edge/cordova_contacts_contacts.md.html#contacts.find" rel="nofollow">link</a></p> <p>The original code is to find all contacts with 'bob' in every field.<br> I changed it to "*"(Just a star) for all my contacts.</p> <p>The function onDeviceReady is just called by a button click.</p> <p>The error I get in the logcat is this: </p> <pre><code>[INFO:CONSOLE(81)] "Uncaught ReferenceError: ContactFindOptions is not defined" 81 is the linenumber with: var options = new ContactFindOptions(); </code></pre> <p>Does anyone know what to do to get the function ContactFindOptions() work?</p> <p>If you need more info, just let me know.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload