forked from stripe-archive/jquery.payment
-
Notifications
You must be signed in to change notification settings - Fork 105
Ontario Photo Health Card Number
Omar Shammas edited this page Sep 13, 2013
·
1 revision
Formats the Ontario Photo Health Card Number in the format 1234 - 123 - 123 - AB
:
- Limits length to 10 numbers and 2 letters
- Restricts input to alphanumeric characters
- Inserts a
-
after the first 4 characters, and every 3 characters going forward.
$('input.ophcn').formance('format_ontario_photo_health_card_number');
Validates the Ontario Photo Health Card Number:
- Does NOT validate whether the health card number actually exists.
- Validates length
- Validates of the format 10 numbers followed by 2 letters
$("<input value='1234123123AB' />").formance('validate_ontario_photo_health_card_number'); // true
$("<input value='1234 - 123 - 123 - AB' />").formance('validate_ontario_photo_health_card_number'); // true
$("<input value='1234 - 123 - 123 - ABC' />").formance('validate_ontario_photo_health_card_number'); // false
$("<input value='12 - 123 - 123 - AB' />").formance('validate_ontario_photo_health_card_number'); // false