can you post the zip you tried and the zips you want to pass?
you would be just swapping the RegEx part of your code you have now.
Code:
<script type="text/javascript">
function validZip(zip)
{
if (zip.match(/^[0-9]{5}$/)) {
return true;
}
zip=zip.toUpperCase();
if (zip.match(/^[A-Z][0-9][A-Z][0-9][A-Z][0-9]$/)) {
return true;
}
if (zip.match(/^[A-Z][0-9][A-Z].[0-9][A-Z][0-9]$/)) {
return true;
}
alert('*** Please enter a valid zip code.');
return false;
}
</script>
<input name="ZIP" type="text" id="ZIP" size="6" maxlength="10" onChange="validZip('zip')"/>
The bits in bold are the RegEx you want to swap with one that works for what your trying to enter and match. I'm not that sure of US and Canada zips being from Scotland
so you need to post samples of what your trying to match.
regards
Ribs
----------------------------------
Bookmarks