[Bug 25587] New: JavaScript issue – “clear” button doesn't reset some dropdowns
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25587 Bug ID: 25587 Summary: JavaScript issue – “clear” button doesn't reset some dropdowns Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: ASSIGNED Severity: minor Priority: P5 - low Component: Circulation Assignee: stalkernoid@gmail.com Reporter: stalkernoid@gmail.com QA Contact: testopia@bugs.koha-community.org CC: gmcharlt@gmail.com, kyle.m.hall@gmail.com, nugged@gmail.com, slavashishkin@gmail.com On cgi-bin/koha/admin/smart-rules.pl “clear” button does not reset fields with a dropdown selector except the first one "Patron Category". -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25587 Peter Vashchuk <stalkernoid@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|JavaScript issue – “clear” |JavaScript issue - "clear" |button doesn't reset some |button doesn't reset some |dropdowns |dropdowns -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25587 Peter Vashchuk <stalkernoid@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25587 --- Comment #1 from Peter Vashchuk <stalkernoid@gmail.com> --- Created attachment 105271 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=105271&action=edit Bug 25587: fix for "clear" button to reset all selects Button "clear" on cgi-bin/koha/admin/smart-rules.pl did not reset fields with a dropdown selector except the first one. This happens because jQuery selector .find("select option:first") in koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt selects only single first element in the whole group, as from jquery doc:
The :first pseudo-class is equivalent to :eq( 0 ). It could also be written as :lt( 1 ). While this matches only a single element, :first-child can match more than one: One for each parent. (https://api.jquery.com/first-selector/)
And it works if replaced by: .find("select option:first-child") -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25587 Peter Vashchuk <stalkernoid@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #105271|0 |1 is obsolete| | --- Comment #2 from Peter Vashchuk <stalkernoid@gmail.com> --- Created attachment 105272 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=105272&action=edit Bug 25587: fix for "clear" button to reset all selects Button "clear" on cgi-bin/koha/admin/smart-rules.pl did not reset fields with a dropdown selector except the first one. This happens because jQuery selector .find("select option:first") in koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt selects only single first element in the whole group, as from jquery doc:
The :first pseudo-class is equivalent to :eq( 0 ). It could also be written as :lt( 1 ). While this matches only a single element, :first-child can match more than one: One for each parent. (https://api.jquery.com/first-selector/)
And it works if replaced by: .find("select option:first-child") To reproduce: 1) Go to /cgi-bin/koha/admin/smart-rules.pl 2) Start editing one of existing rules or filling a new one, change all selects to have non-first option selected. Fill text input fields with sample data. 3) Reset all fields with the "clear" button. 4) Observe that only the first dropdown field was reset to the first option while all others still contain previously given values, meanwhile all text input fields are cleared as expected. 5) Apply the patch. 6) Repeat steps 1, 2 and 3. 7) Check that all dropdown fields were reset to first option, as expected. Mentored-by: Andrew Nugged <nugged@gmail.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25587 Lucas Gass <lucas@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=25587 Lucas Gass <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #105272|0 |1 is obsolete| | --- Comment #3 from Lucas Gass <lucas@bywatersolutions.com> --- Created attachment 105285 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=105285&action=edit Bug 25587: fix for "clear" button to reset all selects Button "clear" on cgi-bin/koha/admin/smart-rules.pl did not reset fields with a dropdown selector except the first one. This happens because jQuery selector .find("select option:first") in koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt selects only single first element in the whole group, as from jquery doc:
The :first pseudo-class is equivalent to :eq( 0 ). It could also be written as :lt( 1 ). While this matches only a single element, :first-child can match more than one: One for each parent. (https://api.jquery.com/first-selector/)
And it works if replaced by: .find("select option:first-child") To reproduce: 1) Go to /cgi-bin/koha/admin/smart-rules.pl 2) Start editing one of existing rules or filling a new one, change all selects to have non-first option selected. Fill text input fields with sample data. 3) Reset all fields with the "clear" button. 4) Observe that only the first dropdown field was reset to the first option while all others still contain previously given values, meanwhile all text input fields are cleared as expected. 5) Apply the patch. 6) Repeat steps 1, 2 and 3. 7) Check that all dropdown fields were reset to first option, as expected. Mentored-by: Andrew Nugged <nugged@gmail.com> Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25587 Julian Maurice <julian.maurice@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #105285|0 |1 is obsolete| | --- Comment #4 from Julian Maurice <julian.maurice@biblibre.com> --- Created attachment 105566 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=105566&action=edit Bug 25587: fix for "clear" button to reset all selects Button "clear" on cgi-bin/koha/admin/smart-rules.pl did not reset fields with a dropdown selector except the first one. This happens because jQuery selector .find("select option:first") in koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt selects only single first element in the whole group, as from jquery doc:
The :first pseudo-class is equivalent to :eq( 0 ). It could also be written as :lt( 1 ). While this matches only a single element, :first-child can match more than one: One for each parent. (https://api.jquery.com/first-selector/)
And it works if replaced by: .find("select option:first-child") To reproduce: 1) Go to /cgi-bin/koha/admin/smart-rules.pl 2) Start editing one of existing rules or filling a new one, change all selects to have non-first option selected. Fill text input fields with sample data. 3) Reset all fields with the "clear" button. 4) Observe that only the first dropdown field was reset to the first option while all others still contain previously given values, meanwhile all text input fields are cleared as expected. 5) Apply the patch. 6) Repeat steps 1, 2 and 3. 7) Check that all dropdown fields were reset to first option, as expected. Mentored-by: Andrew Nugged <nugged@gmail.com> Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> Signed-off-by: Julian Maurice <julian.maurice@biblibre.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25587 Julian Maurice <julian.maurice@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |julian.maurice@biblibre.com 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=25587 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)| |20.11.00 released in| | Status|Passed QA |Pushed to master -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25587 --- Comment #5 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Pushed to master for 20.11, thanks to everybody involved! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25587 Aleisha Amohia <aleisha@catalyst.net.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |aleisha@catalyst.net.nz Status|Pushed to master |Pushed to stable Version(s)|20.11.00 |20.11.00, 20.05.01 released in| | --- Comment #6 from Aleisha Amohia <aleisha@catalyst.net.nz> --- backported to 20.05.x for 20.05.01 (by Lucas) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25587 Aleisha Amohia <aleisha@catalyst.net.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to stable |Pushed to oldstable Version(s)|20.11.00, 20.05.01 |20.11.00, 20.05.01, released in| |19.11.07 --- Comment #7 from Aleisha Amohia <aleisha@catalyst.net.nz> --- backported to 19.11.x for 19.11.07 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25587 Victor Grousset/tuxayo <victor@tuxayo.net> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)|20.11.00, 20.05.01, |20.11.00, 20.05.01, released in|19.11.07 |19.11.07, 19.05.13 Status|Pushed to oldstable |Pushed to oldoldstable CC| |victor@tuxayo.net --- Comment #8 from Victor Grousset/tuxayo <victor@tuxayo.net> --- Backported to 19.05.x branch for 19.05.13 -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org