The new MARC framework tag entry form uses custom validation JavaScript which can be easily replaced with HTML5 validation attributes in conjunction with Koha's built-in validation plugin (http://jqueryvalidation.org/documentation/).
Created attachment 25298 [details] [review] Bug 11771 - Use validation plugin when creating new MARC framework tag The page for adding a new tag to a MARC framework includes some custom form validation JavaScript which can be removed in favor of HTML5 validation attributes and Koha's built-in validation plugin. This patch does so. The patch also moves some tag markup creation out of the script and into the template where it belongs. To test, apply the patch and go to Administration -> MARC bibliographic framework -> MARC structure -> New tag. Try submitting the form without entering a tag number. This should trigger a validation warning. Submission of the form with valid data should work correctly. Editing an existing tag should also work correctly.
Created attachment 25326 [details] [review] Bug 11771 - Use validation plugin when creating new MARC framework tag The page for adding a new tag to a MARC framework includes some custom form validation JavaScript which can be removed in favor of HTML5 validation attributes and Koha's built-in validation plugin. This patch does so. The patch also moves some tag markup creation out of the script and into the template where it belongs. To test, apply the patch and go to Administration -> MARC bibliographic framework -> MARC structure -> New tag. Try submitting the form without entering a tag number. This should trigger a validation warning. Submission of the form with valid data should work correctly. Editing an existing tag should also work correctly. Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Created attachment 25342 [details] [review] Bug 11771 - Use validation plugin when creating new MARC framework tag The page for adding a new tag to a MARC framework includes some custom form validation JavaScript which can be removed in favor of HTML5 validation attributes and Koha's built-in validation plugin. This patch does so. The patch also moves some tag markup creation out of the script and into the template where it belongs. To test, apply the patch and go to Administration -> MARC bibliographic framework -> MARC structure -> New tag. Try submitting the form without entering a tag number. This should trigger a validation warning. Submission of the form with valid data should work correctly. Editing an existing tag should also work correctly. Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz> Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com> Great improvement! Before this patch, I got a JS alert but the form was submitted anyway.
Pushed to master. Thanks, Owen!
Pushed to 3.14.x, will be in 3.14.07