Bug Tracker

Opened 11 years ago

Closed 10 years ago

Last modified 8 years ago

#4066 closed enhancement (invalid)

added postal code field validation for the form validate plugin (for us canadians)

Reported by: dezwald Owned by: joern
Priority: minor Milestone: 1.3.2
Component: plugin Version: 1.3.1
Keywords: validate, validation, form validation Cc:
Blocked by: Blocking:

Description

i have created a 2 validation functions to be added to the additional-methods validation plugin script

these function validate postal code and zip code fields

one validates both postal code and zip code in a field

and the other one just validates postal code

jQuery.validator.addMethod("postalzip", function(value, element) {

return this.optional(element)
/\d{5}(-\d{4})?$)|([ABCEGHJKLMNPRSTVXY]{1}\d{1}[A-Z]{1} *\d{1}[A-Z]{1}\d{1}$/.test(value);

}, "Your ZIP-code must be in the range 902xx-xxxx to 905-xx-xxxx OR your POSTAL CODE must be in the formart of A9A-9A9 or A9A9A9");

jQuery.validator.addMethod("postalcode", function(value, element) {

return this.optional(element)
/[ABCEGHJKLMNPRSTVXY]{1}\d{1}[A-Z]{1} *\d{1}[A-Z]{1}\d{1}$/.test(value);

}, "Your POSTAL CODE must be in the formart of A9A-9A9 or A9A9A9");

Attachments (1)

additional-methods.js (8.1 KB) - added by dezwald 11 years ago.
added 2 postal code field validation functions to the additional-methods.js (one checks for a valid postal code or zip code and the other function checks for just a valid postal code)

Download all attachments as: .zip

Change History (3)

Changed 11 years ago by dezwald

Attachment: additional-methods.js added

added 2 postal code field validation functions to the additional-methods.js (one checks for a valid postal code or zip code and the other function checks for just a valid postal code)

comment:1 Changed 10 years ago by dmethvin

Owner: set to joern

comment:2 Changed 10 years ago by john

Resolution: invalid
Status: newclosed

Please file plugin bugs with the appropriate author on their bug tracker.

Note: See TracTickets for help on using tickets.