If a date input like date of birth is mandatory, in quick add brief form the calendar icon appears but clicking on it does nothing. This is because quick add brief form creates a clone of inputs in the original form. An input with date picker is changed and linked to Javascript code (see calendar.inc) so it can not be cloned. Note also that creating a clone of an input in another form does not update the form value in its DOM. It can generate errors. In my opinion this feature should be reconsidered to hide unwanted fields instead of cloning wanted ones. Many bugs may be avoided.
Also date of birth has a small JS code showing age when date is changed.
How to reproduce this bug? 1. In the system preferences, add "dateofbirth" to "Patrons > General > BorrowerMandatoryField". 2. Go to the "Patrons" page. 3. Click "Quick add new patron" and select a patron category. 4. You will be shown the brief form. 5. Click on the calendar icon next to the "Date of birth" input field.
This is still valid - when marking dateofbirth mandatory, the datepicker doesn't work on the quick add patron form.
Yes, as well as all other date fields. As Fridolin said we should rework the way the fields are displayed/hidden. It's not an easy fix.
I came here to log this bug - the clone of inputs has been giving me a headache this week when trying to target those areas with jQuery, and the non-working datepicker is a real issue for us. I realise it's not an easy fix from what's been said, but just adding a 'still valid' comment.
I can confirm this is still an issue on master. Kind of a sore spot: a quick is not as quick with a broken datepicker.
In our system we do not have Date of Birth as mandatory. We actually have DateOfBirth in BorrowerUnwantedField so it does not appear in either the long or quick patron form. I wanted to comment that we are unable to get the registration date and expiry date fields to appear in the Quick Add form. They are listed as in the Preference PatronQuickAddFields, but are absent from the staff interface. Not sure if this is related to the broken picker issue.
This is an issue for us. Quick add is not as useful to us without the datepicker. If fact, when adding a dateofbirth manually, it does not save. The dateofbirth field is empty when one goes back to edit said patron.
On koha version 20.11, we could still enter the date manually but from 21.11.11, it's not even possible.
Updating severity - this is a bad issue and we have kept it around for too long.
Created attachment 150589 [details] [review] Bug 19249: Fix date inputs on patron quick add form This patch create a "apply_flatpickr" JS function to make the code reusable from the template, where we loop over the date inputs to reinstantiate flatpickr.
Created attachment 150632 [details] [review] Bug 19249: Fix date inputs on patron quick add form This patch create a "apply_flatpickr" JS function to make the code reusable from the template, where we loop over the date inputs to reinstantiate flatpickr. Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Works as described, thanks for this important fix!
Created attachment 150644 [details] [review] Bug 19249: Fix date inputs on patron quick add form This patch create a "apply_flatpickr" JS function to make the code reusable from the template, where we loop over the date inputs to reinstantiate flatpickr. Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk> Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Created attachment 150679 [details] [review] Bug 19249: Fix date inputs on patron quick add form This patch create a "apply_flatpickr" JS function to make the code reusable from the template, where we loop over the date inputs to reinstantiate flatpickr. Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Nicolas Giraud <nicolas.giraud@inlibro.com>
Pushed to master for 23.05. Nice work everyone, thanks!
Many hands makes light work, thankyou everyone! Pushed to 22.11.x for the next release
Does not apply cleanly to 22.05.x, no backport.