Note that there are some explanatory texts on larger screens.

plurals
  1. POValidator remote method, matching value to JSON array
    primarykey
    data
    text
    <p>Aloha!</p> <p>Trying to run a basic validation on a postal code input, and additionally check the entered value to see if it exists in a keyless JSON array. Everything works as expected until I add the remote function. If possible, I'd like to utilize this function, since it is built in, but I am open to other methods of validation.</p> <p>Working example of this, without remote, here: <a href="http://jsfiddle.net/sangria/xLGae/" rel="nofollow">http://jsfiddle.net/sangria/xLGae/</a></p> <p>Likely unrelated, but getting this error in the console on submit:</p> <pre><code>Uncaught Error: NOT_FOUND_ERR: DOM Exception 8 </code></pre> <p>JSON array format:</p> <pre><code>[94102,94117,94110,99950,...] </code></pre> <p>jQuery and Validation:</p> <pre><code>jQuery.validator.addMethod("postalcode", function(postalcode, element) { return this.optional(element) || postalcode.match(/^([0-9]{5})$/); }, "Please specify a valid postal/zip code"); $("#postal").validate({ rules: { zipcode: { required: true, postalcode: true, digits: true, minlength: 5, maxlength: 5, remote: { type: 'post', contentType: 'application/json; charset=utf-8', url: "data/uszipsonly.json", dataType: 'json', async: false } } }, messages: { zipcode: { remote: "Please specify a US postal code"} } }); </code></pre> <p>Pored over the docs and some other good <a href="http://www.opencoder.co.uk/2010/07/jquery-remote-form-validation/" rel="nofollow">examples</a>. Found similar threads here on SO, but still somewhat tripped up by this.</p> <p>Much thanks to the community for any enlightenment.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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