[Bug 23625] New: ArticleRequestsMandatoryFields* only affects field labels, does not make inputs required
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23625 Bug ID: 23625 Summary: ArticleRequestsMandatoryFields* only affects field labels, does not make inputs required Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: normal Priority: P5 - low Component: OPAC Assignee: oleonard@myacpl.org Reporter: ephetteplace@cca.edu QA Contact: testopia@bugs.koha-community.org Steps to recreate: 1) Enable article requests ( syspref: ArticleRequests => Enable, Circ and fine rules ALL/ALL (or a given category/itemtype): Article requests => Yes ) 2) Set one or more fields to require in the ArticleRequestsMandatoryFields, ArticleRequestsMandatoryFieldsItemOnly, and/or ArticleRequestsMandatoryFieldsRecordOnly settings (all these settings are affected in the same manner) 3) Search for a title and select the "Request Article" button from the OPAC search results 4) Authenticate as a patron 5) Neglect to fill out at least one of the mandatory fields (their <label>s will have a "required" class making them appear red in the default theme) 6) Select the "Place Request" button at the bottom of the form 7) The form should not submit without the required fields but it does anyways. The basic issue is that the opac-request-article.tt template https://github.com/Koha-Community/Koha/blob/master/koha-tmpl/opac-tmpl/boots... creates the same non-required <input> elements regardless of whether a field is required or not. Here is one example: <li> [% IF mandatory_fields.search('title') %] <label for="title" class="required">Title:</label> [% ELSE %] <label for="title">Title:</label> [% END %] <input type="text" name="title" id="title" size="50"/> </li> I believe that all of the form fields should be modified such that both the <label> AND <input> are different depending on whether a field is required or not: <li> [% IF mandatory_fields.search('title') %] <label for="title" class="required">Title:</label> <input type="text" required name="title" id="title" size="50"/> [% ELSE %] <label for="title">Title:</label> <input type="text" name="title" id="title" size="50"/> [% END %] </li> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23625 Eric Phetteplace <ephetteplace@cca.edu> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |ephetteplace@cca.edu -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23625 --- Comment #1 from Eric Phetteplace <ephetteplace@cca.edu> --- If it's useful for others, we're using the following snippet in OPACUserJS to work around this bug: https://github.com/cca/koha_snippets/blob/master/catalog-js/opac-request-art... // fields made mandatory in settings only have <label> with a "required" class // we need to make their corresponding inputs required, too if (location.pathname.match('/cgi-bin/koha/opac-request-article.pl')) { $('#place-article-request label.required').each((idx, el) => { let input = $(el).attr('for') $(`#${input}`).prop('required', true) }) } -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23625 --- Comment #2 from Eric Phetteplace <ephetteplace@cca.edu> --- Created attachment 92846 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=92846&action=edit Bug 23625: ArticleRequestsMandatoryFields* only affects field labels, does not make inputs required -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23625 Eric Phetteplace <ephetteplace@cca.edu> changed: What |Removed |Added ---------------------------------------------------------------------------- Change sponsored?|--- |Sponsored Status|NEW |Needs Signoff Patch complexity|--- |Trivial patch -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23625 --- Comment #3 from Eric Phetteplace <ephetteplace@cca.edu> --- I created a patch sticking closely to what the template already looked like. But I do wonder if incredibly repetitive templating like this isn't better as a loop: [% FOREACH field IN ['title', 'author', 'volume', 'issue', 'date', 'pages' , 'chapters'] %] <li> [% IF mandatory_fields.search(field) %] <label for="[% field %]" class="required">[% field FILTER ucfirst %]:</label> <input type="text" required name="[% field %]" id="[% field %]" size="50"/> [% ELSE %] <label for="[% field %]">[% field FILTER ucfirst %]:</label> <input type="text" name="[% field %]" id="[% field %]" size="50"/> [% END %] </li> [% END %] Is there a reason that pattern isn't used here? Does it not play well with internationalization? I don't know template toolkit that well so forgive me if it doesn't work, I'm just speculating based on reading some documentation. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23625 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #92846|0 |1 is obsolete| | --- Comment #4 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 92922 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=92922&action=edit Bug 23625: Make new 'required' attributes match the currently used syntax in other templates -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23625 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23625 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #92922|0 |1 is obsolete| | --- Comment #5 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 92923 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=92923&action=edit Bug 23625: ArticleRequestsMandatoryFields* only affects field labels, does not make inputs required Test plan: 1. Enable article requests ( syspref: ArticleRequests => Enable, Circ and fine rules ALL/ALL (or a given category/itemtype): Article requests => Yes ) 2. Set one or more fields to require in the ArticleRequestsMandatoryFields, ArticleRequestsMandatoryFieldsItemOnly, and/or ArticleRequestsMandatoryFieldsRecordOnly settings (all these settings are affected in the same manner) 3. Search for a title and select the "Request Article" button from the OPAC search results 4. Authenticate as a patron 5. Neglect to fill out at least one of the mandatory fields 6. Select the "Place Request" button at the bottom of the form 7. The form submits despite the empty mandatory fields 8. Apply patch 9. Repeat steps 3, 5, & 6 10 . The form should refuse to submit, show a browser-native message about the missing required fields. Sponsored-by: California College of the Arts Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23625 --- Comment #6 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 92924 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=92924&action=edit Bug 23625: Make new 'required' attributes match the currently used syntax in other templates Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23625 Owen Leonard <oleonard@myacpl.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|oleonard@myacpl.org |ephetteplace@cca.edu -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23625 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23625 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #92923|0 |1 is obsolete| | --- Comment #7 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Created attachment 93182 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=93182&action=edit Bug 23625: ArticleRequestsMandatoryFields* only affects field labels, does not make inputs required Test plan: 1. Enable article requests ( syspref: ArticleRequests => Enable, Circ and fine rules ALL/ALL (or a given category/itemtype): Article requests => Yes ) 2. Set one or more fields to require in the ArticleRequestsMandatoryFields, ArticleRequestsMandatoryFieldsItemOnly, and/or ArticleRequestsMandatoryFieldsRecordOnly settings (all these settings are affected in the same manner) 3. Search for a title and select the "Request Article" button from the OPAC search results 4. Authenticate as a patron 5. Neglect to fill out at least one of the mandatory fields 6. Select the "Place Request" button at the bottom of the form 7. The form submits despite the empty mandatory fields 8. Apply patch 9. Repeat steps 3, 5, & 6 10 . The form should refuse to submit, show a browser-native message about the missing required fields. Sponsored-by: California College of the Arts Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23625 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #92924|0 |1 is obsolete| | --- Comment #8 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Created attachment 93183 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=93183&action=edit Bug 23625: Make new 'required' attributes match the currently used syntax in other templates Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23625 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |m.de.rooy@rijksmuseum.nl QA Contact|testopia@bugs.koha-communit |m.de.rooy@rijksmuseum.nl |y.org | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23625 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to master Version(s)| |19.11.00 released in| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23625 --- Comment #9 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Nice work! Pushed to master for 19.11.00 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23625 Fridolin SOMERS <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to master |Pushed to stable CC| |fridolin.somers@biblibre.co | |m Version(s)|19.11.00 |19.11.00,19.05.05 released in| | --- Comment #10 from Fridolin SOMERS <fridolin.somers@biblibre.com> --- Pushed to 19.05.x for 19.05.05 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23625 Lucas Gass <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |lucas@bywatersolutions.com Status|Pushed to stable |Pushed to oldstable --- Comment #11 from Lucas Gass <lucas@bywatersolutions.com> --- backported to 18.11.x for 18.11.11 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23625 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dcook@prosentient.com.au --- Comment #12 from David Cook <dcook@prosentient.com.au> --- Hmm I don't know if this is working in newer versions... -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23625 --- Comment #13 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- (In reply to David Cook from comment #12)
Hmm I don't know if this is working in newer versions...
I've filed a new bug report after testing this in master: Bug 31294 - Article requests: Mandatory subfields in OPAC don't show they are required The visual is missing, bit it complains when saving. -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org