Bug 26218 - Add JavaScript validation to date of birth field in OPAC registration form
Summary: Add JavaScript validation to date of birth field in OPAC registration form
Status: RESOLVED INVALID
Alias: None
Product: Koha
Classification: Unclassified
Component: OPAC (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Amit Gupta
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-08-14 18:13 UTC by Amit Gupta
Modified: 2023-09-22 19:44 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Screenshot1 (15.60 KB, image/png)
2020-08-14 18:16 UTC, Amit Gupta
Details
Screenshot2 (21.44 KB, image/png)
2020-08-14 18:17 UTC, Amit Gupta
Details
Bug 26218: When a patron is created or edited from OPAC and the date of birth is invalid it showing invalid date of birth in the text box even if text box focus is out (6.65 KB, patch)
2020-08-15 17:37 UTC, Amit Gupta
Details | Diff | Splinter Review
Bug 26218: Added jquery validation in opac-reserve.pl page for calendar icon. (1.13 KB, patch)
2020-08-15 17:38 UTC, Amit Gupta
Details | Diff | Splinter Review
Bug 26218: Added jquery validation in opac-reserve.pl page for calendar icon. (1.19 KB, patch)
2020-08-19 15:18 UTC, Brandon J
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Amit Gupta 2020-08-14 18:13:24 UTC

    
Comment 1 Amit Gupta 2020-08-14 18:16:45 UTC
Created attachment 108307 [details]
Screenshot1

When a patron is created or edited from OPAC and the date of birth is invalid it is not giving any alert message.
Comment 2 Amit Gupta 2020-08-14 18:17:34 UTC
Created attachment 108308 [details]
Screenshot2
Comment 3 Amit Gupta 2020-08-15 17:37:10 UTC
Created attachment 108334 [details] [review]
Bug 26218: When a patron is created or edited from OPAC and  the date of birth is invalid it showing invalid date of birth in the text box  even if text box focus is out

To Test:
1. Create the patron category from the staff page for ex: ST
2. Set PatronSelfRegistration to allow.
3. Allow category in PatronSelfRegistrationDefaultCategory for online registration from opac.
4. Go to /cgi-bin/koha/opac-memberentry.pl page.
5. Fill the form and give any invalid date and it show invalid date of birth in the date of birth text box even if text box focus is out.
6. Apply the patch.
7. Go to /cgi-bin/koha/opac-memberentry.pl page.
8. Fill the form and give any invalid date and it show blank value in the date of birth text box once text box focus is out.

-------------------------------------------------

This patch will work for both new or edit patron from the OPAC.
Comment 4 Amit Gupta 2020-08-15 17:38:08 UTC
Created attachment 108335 [details] [review]
Bug 26218: Added jquery validation in opac-reserve.pl page  for calendar icon.

To Test:
1. Search the catalog record in the OPAC.
2. Click on place hold
3. Go to /cgi-bin/koha/opac-reserve.pl?biblionumber=xxx
4. Click on Show more option. Calender icon is not coming.
5. Apply the patch.
6. Click on Show more option. Now you can able to see the calender icon.
Comment 5 Owen Leonard 2020-08-17 17:46:27 UTC
With these patches applied the date field doesn't seem to work at all on the patron entry form. If I use the datepicker the field is not populated with any data. If I manually type a number it is cleared when I tab away from the field.

I'm not sure what the second patch is supposed to do. I see the calendar icon in master, and adding the validation plugin isn't going to change anything about how the datepicker works.
Comment 6 Amit Gupta 2020-08-18 17:29:37 UTC
(In reply to Owen Leonard from comment #5)
> With these patches applied the date field doesn't seem to work at all on the
> patron entry form. If I use the datepicker the field is not populated with
> any data. If I manually type a number it is cleared when I tab away from the
> field.
> 
> I'm not sure what the second patch is supposed to do. I see the calendar
> icon in master, and adding the validation plugin isn't going to change
> anything about how the datepicker works.

Hi Owen,

I have checked and patch is working OK and not found any issue in date of birth field. I am using the same javascript which we are using on the staff interface for the date of birth field.

I have applied the patch and not found any issue. You can also check with the below URL. 

http://52.172.128.94:9093/cgi-bin/koha/opac-memberentry.pl

Second patch is related to first patch. After applying the first patch I noticed calendar icon is not visible in opac-reserve.pl page. 

I did the fix and added [% Asset.js("lib/jquery/plugins/jquery.validate.min.js") | $raw %] to show the calendar icon.
Comment 7 Brandon J 2020-08-19 15:18:36 UTC
Created attachment 108657 [details] [review]
Bug 26218: Added jquery validation in opac-reserve.pl page for calendar icon.

To Test:
1. Search the catalog record in the OPAC.
2. Click on place hold
3. Go to /cgi-bin/koha/opac-reserve.pl?biblionumber=xxx
4. Click on Show more option. Calender icon is not coming.
5. Apply the patch.
6. Click on Show more option. Now you can able to see the calender icon.

Signed-off-by: Brandon J <brandon.jimenez@inLibro.com>
Comment 8 Amit Gupta 2020-08-19 15:46:48 UTC
Hi Brandon,

Thanks for looking the patch and testing. You have checked only patch and you look into the other one.
Comment 9 Amit Gupta 2020-08-19 15:48:38 UTC
(In reply to Amit Gupta from comment #8)
> Hi Brandon,
> 
> Thanks for looking the patch and testing. You have checked only patch and
> you look into the other one.

Hi Brandon,

Thanks for looking the patch and testing. You have checked only patch can you look into the other one.
Comment 10 Katrin Fischer 2020-08-22 14:35:17 UTC
Hi Brandon, please check your process for signing off bugs with mulitple patches - we need the sign-off lines on all patches and the old ones to be marked obsolete. Git bz can help you with all that!
Comment 11 Katrin Fischer 2020-08-22 15:02:54 UTC
Hi Amit,

I have checked the patches here:

1) Change for date of birth

I can replicate the error Owen describes when I change the dateformat to dd.mm.yyyy. I click on the datepicker, select a date, but the input field remains empty. It works without the patch.

This works as described for mm/dd/yyyy, but I feel like this would be irritating to users. I'd prefer if we displayed a validation error "Date is invalid, please enter a correct date" or similar. 



2) Change to opac-reserve.pl

I think this would be a separate problem for another bug and should be moved if necessary. But that said, I cannot replicate the problem you describe. :( I have checked the opac-reserve.pl page on master:

- Place hold
- More options
- Calendar icon on "Hold not needed after:" shows and works as expected.
Comment 12 Katrin Fischer 2023-09-22 19:44:27 UTC
I believe this bug was invalidaed by our move to flatpickr. Please reopen if you disagree!