LP1950166 TPac: Self-registration form won't submit with blank DOB
authorGarry Collum <gcollum@gmail.com>
Tue, 9 Nov 2021 16:09:48 +0000 (11:09 -0500)
committerGalen Charlton <gmc@equinoxOLI.org>
Wed, 29 Jun 2022 20:02:00 +0000 (16:02 -0400)
Adds a check for a blank value in the DOB validation script. Note
that the issue is present in TPAC, not the Bootsstrap OPAC.

To test:
1. Confirm "Require dob field on patron registration" is not set or set to False.
2. Confirm "Show dob field on patron registration" is true.
3. Confirm "Allow Patron Self-Registration" is set to true.
4. Try to register a patron in the TPAC with DOB blank.
5. Apply patch.
6. Try to register a patron in the TPAC with the DOB blank.
7. Try to register a patron with Invalid DOB input.
8. Try to register a patron with valid DOB input.

Signed-off-by: Garry Collum <gcollum@gmail.com>
Signed-off-by: Gina Monti <gmonti@biblio.org>
Signed-off-by: Galen Charlton <gmc@equinoxOLI.org>

Open-ILS/src/templates/opac/parts/js.tt2

index 71512ec..c597c31 100644 (file)
@@ -33,7 +33,7 @@
     function dobValidate(input) {
         var validformat = /^(19|20)\d\d([- /.])(0[1-9]|1[012])\2(0[1-9]|[12][0-9]|3[01])$/
         var returnval = false
-        if (!validformat.test(input.value))
+        if (input.value != '' && !validformat.test(input.value))
             alert("[% l('You have entered an invalid date, or an improperly formatted date.  Please enter Date of Birth in YYYY-MM-DD or YYYY/MM/DD format and try again.') %]")
         else
             returnval = true