When a user self registers at the OPAC and doesn't fill out the captcha, and error message is displaysed: "This field is required." This string doesn't appear in the po files for the OPAC. I the intanet it appears in validator-strings.inc, but there doesn't appear to be a corresponding file for the OPAC. Could this be the reason for the translation issue?
I've retitled this bug to accommodate the expanded scope of the work I ended up doing. Besides simply adding the missing validator strings include file I'm restructuring the template logic around mandatory fields to try to make it more efficient and easier to read.
Created attachment 116689 [details] [review] Bug 27668: Improve validation of patron entry form in the OPAC This patch improves the way we handle required fields in the patron entry/update form in the OPAC. Instead of doing multiple checks for each field using mandatory.defined(), the template now loops over a list of fields and sets a "required" variable for any which are required. Then, for each form field, the "required" variable is used to set classes on labels, input fields, and the "required" text hints. The class on form fields acts as a hook for the jQuery validator plugin. The class on the text hints allows us to hide the text hint using CSS, eliminating the necessity of using a template conditional. The patch also adds the missing validator-strings include which enables translation of the jQuery validator plugin's validation error messages. To test, apply the patch and rebuild the OPAC CSS (https://wiki.koha-community.org/wiki/Working_with_SCSS_in_the_OPAC_and_staff_client). - Go to Administration -> System preferences and enable PatronSelfRegistration. - Select multiple fields to be required using the PatronSelfRegistrationBorrowerMandatoryField preference. - In the OPAC, start the process of registering for an account. - The fields you designated as mandatory should each have a "Required" label under them. - Try to submit the form without entering any data. The required fields should now be highlighted in red and have another label, "This field is required." - Fill in the required fields and submit the form. It should submit correctly. - Modify the PatronSelfRegistrationBorrowerMandatoryField preference and select all fields as mandatory. Confirm that all fields in the patron entry form work correctly. - Test that form validation works correctly when modifying a logged-in patron's existing account.
Created attachment 117716 [details] [review] Bug 27668: Improve validation of patron entry form in the OPAC This patch improves the way we handle required fields in the patron entry/update form in the OPAC. Instead of doing multiple checks for each field using mandatory.defined(), the template now loops over a list of fields and sets a "required" variable for any which are required. Then, for each form field, the "required" variable is used to set classes on labels, input fields, and the "required" text hints. The class on form fields acts as a hook for the jQuery validator plugin. The class on the text hints allows us to hide the text hint using CSS, eliminating the necessity of using a template conditional. The patch also adds the missing validator-strings include which enables translation of the jQuery validator plugin's validation error messages. To test, apply the patch and rebuild the OPAC CSS (https://wiki.koha-community.org/wiki/Working_with_SCSS_in_the_OPAC_and_staff_client). - Go to Administration -> System preferences and enable PatronSelfRegistration. - Select multiple fields to be required using the PatronSelfRegistrationBorrowerMandatoryField preference. - In the OPAC, start the process of registering for an account. - The fields you designated as mandatory should each have a "Required" label under them. - Try to submit the form without entering any data. The required fields should now be highlighted in red and have another label, "This field is required." - Fill in the required fields and submit the form. It should submit correctly. - Modify the PatronSelfRegistrationBorrowerMandatoryField preference and select all fields as mandatory. Confirm that all fields in the patron entry form work correctly. - Test that form validation works correctly when modifying a logged-in patron's existing account. Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> https://bugs.koha-community.org/show_bug.cgi?id=27688
Created attachment 117799 [details] [review] Bug 27668: Improve validation of patron entry form in the OPAC This patch improves the way we handle required fields in the patron entry/update form in the OPAC. Instead of doing multiple checks for each field using mandatory.defined(), the template now loops over a list of fields and sets a "required" variable for any which are required. Then, for each form field, the "required" variable is used to set classes on labels, input fields, and the "required" text hints. The class on form fields acts as a hook for the jQuery validator plugin. The class on the text hints allows us to hide the text hint using CSS, eliminating the necessity of using a template conditional. The patch also adds the missing validator-strings include which enables translation of the jQuery validator plugin's validation error messages. To test, apply the patch and rebuild the OPAC CSS (https://wiki.koha-community.org/wiki/Working_with_SCSS_in_the_OPAC_and_staff_client). - Go to Administration -> System preferences and enable PatronSelfRegistration. - Select multiple fields to be required using the PatronSelfRegistrationBorrowerMandatoryField preference. - In the OPAC, start the process of registering for an account. - The fields you designated as mandatory should each have a "Required" label under them. - Try to submit the form without entering any data. The required fields should now be highlighted in red and have another label, "This field is required." - Fill in the required fields and submit the form. It should submit correctly. - Modify the PatronSelfRegistrationBorrowerMandatoryField preference and select all fields as mandatory. Confirm that all fields in the patron entry form work correctly. - Test that form validation works correctly when modifying a logged-in patron's existing account. Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Works well, and is a general improvement. Passing QA
Pushed to master for 21.05, thanks to everybody involved!
Nice. But lot of changes. This is more en enhancement no ? Since it is for OPAC : Is it safe for backport on 20.11.x ?