Checking for Valid Canadian SIN Using Adobe XI
i creating form request sin number employee,
i have used format sin , located in custom format script.
// custom format script
(function() {
if (event.value != "") {
var re_bp_frmt = /^(\d{3,3})[.-/ ]?(\d{3,3})[.-/ ]?(\d{3,3})$/; // entry 000-000-000;
if(re_bp_frmt.test(event.value)) {
event.value = regexp.$1 + "-" + regexp.$2 + "-" + regexp.$3;
} // end re testing
} // end custom format script
} ) ();
// end custom format script
once have sin number have check using formula see if valid sin. can this. if user not enter 9 digits should error message, if not enter valid sin should error message. if please me it, appreciated it.
since regexp test has determined 9 numbers or 9 numbers , optional separators have been entered , valid "if ... then" statement, else not valid. add "else" clause if statement.
// custom format script
(function() {
if (event.value != "") {
var re_bp_frmt = /^(\d{3})[.-/ ]?(\d{3})[.-/ ]?(\d{3})$/; // entry 000-000-000;
if(re_bp_frmt.test(event.value)) {
event.value = regexp.$1 + "-" + regexp.$2 + "-" + regexp.$3;
} else {
app.alert(event.value + " not valid social insurance number. please reenter.", 1, 0);
}
// end re testing
} // end not null entry
} ) ();
// end custom format script
you write custom keystroke script sin.
More discussions in JavaScript
adobe
Comments
Post a Comment