test

function validateID() { var cb = document.forms["pleasevalidateme"]["saidCB"].checked; if (cb) { var ex = /^(((d{2}((0[13578]|1[02])(0[1-9]|[12]d|3[01])|(0[13456789]|1[012])(0[1-9]|[12]d|30)|02(0[1-9]|1d|2[0-8])))|([02468][048]|[13579][26])0229))(( |-)(d{4})( |-)(d{3})|(d{7}))/; } else { // some other validation here var ex = /^[0-9]{1,}$/; } var theIDnumber = document.forms["pleasevalidateme"]["idnumber"].value; if (ex.test(theIDnumber) == false) { // alert code goes here alert('Please supply a valid ID number'); return false; } return true; }