PINES Custom fix for Patron Self Registration Form DOB Validation
authorTerran McCanna <tmccanna@georgialibraries.org>
Fri, 7 Dec 2018 22:10:16 +0000 (17:10 -0500)
committerChris Sharp <csharp@georgialibraries.org>
Wed, 30 Jan 2019 14:18:27 +0000 (09:18 -0500)
This moved away from master at some point. This patch brings it back
in line along with correcting a dob format checking error.

Signed-off-by: Terran McCanna <tmccanna@georgialibraries.org>
Open-ILS/src/templates/opac/parts/js.tt2
Open-ILS/src/templates/opac/register.tt2

index 19ad6ff..fb20dd2 100644 (file)
@@ -9,10 +9,10 @@
 <!-- DOB validation for Patron Registration in OPAC -->
 <script type="text/javascript">
     function dobValidate(input) {
-        var validformat = /^(19|20)\d\d([- /.])(0[1-9]|1[012])\2(0[1-9]|[12][0-9]|3[01])$/
+        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))
-            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.') %]")
+            alert("[% l('You have entered an invalid date, or an improperly formatted date.  Please enter Date of Birth in YYYY-MM-DD format and try again.') %]")
         else
             returnval = true
         if (returnval == false) input.select()
index 30cc322..90a1ba7 100644 (file)
@@ -99,7 +99,7 @@ END;
                 ) | html %]</h4>
         [% END %]
 
-        <form method='POST'>
+        <form method='POST' onSubmit="return dobValidate(document.getElementById('stgu.dob'))">
             <table>
                 <tr>
                     <td valign="top">
@@ -162,6 +162,7 @@ FOR field_def IN register_fields;
     <td>
         <input 
             type='text' 
+            id='[% field_path %]'
             name='[% field_path %]'
             value='[% value || CGI.param(field_path) | html %]'/>
         [% IF require %]