The OPAC suggestion form required JavaScript in order to make required fields mandatory. I think we should replace this with HTML5 'required' attributes and more processing in the template. This makes the form fit better with the general goal of progressive enhancement for the OPAC.
Created attachment 87526 [details] [review] Bug 22657: Remove JavaScript from OPAC suggestion validation of required fields This patch modifies the OPAC suggestion form so that it doesn't require JavaScript for form validation. This change doesn't alter the behavior of the form for users but does fit with the general goal of progressive enhancement for the OPAC. The patch adds "required" labels to required fields to better identify required fields. To test, apply the patch and make sure there are required fields specified in the OPACSuggestionMandatoryFields system preference. - Log in to the OPAC and go to Your purchase suggestions -> New purchase suggestion. - Verify that the fields specified in OPACSuggestionMandatoryFields are highlighted and marked "required." - Verify that you can't submit the form without filling out these fields.
Created attachment 87939 [details] [review] Bug 22657: Remove JavaScript from OPAC suggestion validation of required fields This patch modifies the OPAC suggestion form so that it doesn't require JavaScript for form validation. This change doesn't alter the behavior of the form for users but does fit with the general goal of progressive enhancement for the OPAC. The patch adds "required" labels to required fields to better identify required fields. To test, apply the patch and make sure there are required fields specified in the OPACSuggestionMandatoryFields system preference. - Log in to the OPAC and go to Your purchase suggestions -> New purchase suggestion. - Verify that the fields specified in OPACSuggestionMandatoryFields are highlighted and marked "required." - Verify that you can't submit the form without filling out these fields. Signed-off-by: Bin Wen <bin.wen@inlibro.com>
Created attachment 88132 [details] Screenshot of wandering required message Something is a bit odd here: - Go to the OPAC - New purchase suggestion (title is required) - Submit - Please fill out this field is shown - Scroll - Verify the note stays in the same place while the form moves Owen, can you please check?
(In reply to Katrin Fischer from comment #3) > - Scroll > - Verify the note stays in the same place while the form moves The validation is done using the browser's built-in interpretation of the HTML5 attribute "required." What you see appears to be a browser bug. I see it in Firefox but not Chrome.
(In reply to Owen Leonard from comment #4) > (In reply to Katrin Fischer from comment #3) > > > - Scroll > > - Verify the note stays in the same place while the form moves > > The validation is done using the browser's built-in interpretation of the > HTML5 attribute "required." What you see appears to be a browser bug. I see > it in Firefox but not Chrome. Actually, I was kind of afraid you'd say that. Should we push or wait a bit until this is fixed? on the form it's really confusing.
Sorry Owen, bug 22800 created a conflict with this one: CONFLICT (content): Merge conflict in opac/opac-suggestions.pl CONFLICT (content): Merge conflict in koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt
Created attachment 89504 [details] [review] Bug 22657: Remove JavaScript from OPAC suggestion validation of required fields This patch modifies the OPAC suggestion form so that it doesn't require JavaScript for form validation. This change doesn't alter the behavior of the form for users but does fit with the general goal of progressive enhancement for the OPAC. The patch adds "required" labels to required fields to better identify required fields. To test, apply the patch and make sure there are required fields specified in the OPACSuggestionMandatoryFields system preference. - Log in to the OPAC and go to Your purchase suggestions -> New purchase suggestion. - Verify that the fields specified in OPACSuggestionMandatoryFields are highlighted and marked "required." - Verify that you can't submit the form without filling out these fields. Signed-off-by: Bin Wen <bin.wen@inlibro.com>
A good reason for that change: - @mandatoryfields = sort split(/\s*\,\s*/, $fldsreq_sp); + @mandatoryfields = split( ",", $fldsreq_sp ); ? I think the regex must be kept as it, just in case.
Created attachment 89520 [details] [review] Bug 22657: (QA follow-up) Restore previous version of regex This patch restores the previous version of the regular expression which parses the OPACSuggestionMandatoryFields system preference value.
Created attachment 89525 [details] [review] Bug 22657: Remove JavaScript from OPAC suggestion validation of required fields This patch modifies the OPAC suggestion form so that it doesn't require JavaScript for form validation. This change doesn't alter the behavior of the form for users but does fit with the general goal of progressive enhancement for the OPAC. The patch adds "required" labels to required fields to better identify required fields. To test, apply the patch and make sure there are required fields specified in the OPACSuggestionMandatoryFields system preference. - Log in to the OPAC and go to Your purchase suggestions -> New purchase suggestion. - Verify that the fields specified in OPACSuggestionMandatoryFields are highlighted and marked "required." - Verify that you can't submit the form without filling out these fields. Signed-off-by: Bin Wen <bin.wen@inlibro.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Created attachment 89526 [details] [review] Bug 22657: (QA follow-up) Restore previous version of regex This patch restores the previous version of the regular expression which parses the OPACSuggestionMandatoryFields system preference value. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
This is cleanup I would like to see move ahead if the browser issue is reasonable, will test next week so considering for 19.05
Awesome work all! Pushed to master for 19.05
(In reply to Katrin Fischer from comment #5) > > The validation is done using the browser's built-in interpretation of the > > HTML5 attribute "required." What you see appears to be a browser bug. I see > > it in Firefox but not Chrome. > > Actually, I was kind of afraid you'd say that. Should we push or wait a bit > until this is fixed? on the form it's really confusing. I don't think this is too bad, the red highlight makes it fairly obvious which field and any click clears. Still keeping my fingers crossed for firefox to fix it
Enhancement will not be backported to 18.11.x series.