Created attachment 105571 [details] Expected result: The focused field being clearly in view. Steps to reproduce: login: demo password: demo - http://koha.adminkuhn.ch:8080/cgi-bin/koha/members/memberentry.pl?op=add&categorycode=K - Fill in Surname and Save. Result: Focus is set on input with id="cardnumber". Bug: The object is out of view. Expected result: The focused field being clearly in view.
$("#entryform").validate({ focusInvalid: false, invalidHandler: function(form, validator) { var errors = validator.numberOfInvalids(); if (errors) { window.scrollTo(0, 0); validator.errorList[0].element.focus(); window.scrollBy(0,$(window).height()/1.618); } }, This will set the element at the "golden section" in the window. Can anyone think of a simpler way to do it?
Above code is in koha-tmpl/intranet-tmpl/prog/js/members.js
I don't find that the above code does what you want it to. Testing in Firefox and Chrome on Mac the result is that the first invalid field is still hidden at the top of the page by the floating toolbar. Also: If you submit your change as a patch it will be easier for folks to test it.
Created attachment 105574 [details] [review] $("#entryform").validate focuses invalid field clearly in view.
Created attachment 105575 [details] [review] Bug 25680 - When adding a new patron and missing to fill a field, on saving, the invalidFocus should show the focused field clearly in view. This patch will center the focused field at the golden section in the window. To test: 1) Begin to add a new patron. 2) Leave a required field empty, which is outside the screen view, and click Save. 3) Notice that the field is at the bottom, behind the language bar if there is one. 4) Apply patch 5) Add a new patron. 6) Leave the required field empty again and Save. 7) Notice that the required field is now clearly shown in view. 8) Sign off.
Created attachment 105576 [details] [review] Bug 25680 - When adding a new patron and missing to fill a field, on saving, the invalidFocus should show the focused field clearly in view. This patch will center the focused field at the golden section in the window. To test: 1) Begin to add a new patron. 2) Leave a required field empty, which is outside the screen view, and click Save. 3) Notice that the field is at the bottom, behind the language bar if there is one. 4) Apply patch 5) Add a new patron. 6) Leave the required field empty again and Save. 7) Notice that the required field is now clearly shown in view. 8) Sign off.
Created attachment 105577 [details] [review] Bug 25680 - When adding a new patron and missing to fill a field, on saving, the invalidFocus should show the focused field clearly in view. This patch will center the focused field at the golden section in the window. To test: 1) Begin to add a new patron. 2) Leave a required field empty, which is outside the screen view, and click Save. 3) Notice that the field is at the bottom, behind the language bar if there is one. 4) Apply patch 5) Add a new patron. 6) Leave the required field empty again and Save. 7) Notice that the required field is now clearly shown in view. 8) Sign off.
In both my production server and a Bywater Sandbox the behavior already works. If I have a required field that isn't filled out it gets centered on the screen without applying the patch. I also tested to make sure it will do this if the "save" toolbar is covering the required field. Lisette
I've tried to test this. I've left off cardnumber and it didn't center, but only appeared at the bottom of the screen. I was using Firefox, wonder if the browser makes a difference? I wanted to compare with the patch, but it currently doesn't apply.
(In reply to Katrin Fischer from comment #9) > I was using Firefox, wonder if > the browser makes a difference? In this situation does. :) > I wanted to compare with the patch, but it currently doesn't apply. Is there an error?
Created attachment 105619 [details] [review] Bug 25680 - When adding a new patron and missing to fill a field, on saving, the invalidFocus should show the focused field clearly in view. This patch will center the focused field at the golden section in the window. To test: 1) Begin to add a new patron. 2) Leave a required field empty, which is outside the screen view, and click Save. 3) Notice that the field is at the bottom, behind the language bar if there is one. 4) Apply patch 5) Add a new patron. 6) Leave the required field empty again and Save. 7) Notice that the required field is now clearly shown in view. 8) Sign off.
(In reply to Katrin Fischer from comment #9) > I wanted to compare with the patch, but it currently doesn't apply. There was an old attachment that I had to obsolete. Please try it again now with the correct one.
Created attachment 105774 [details] [review] Bug 25680: When adding a new patron and missing to fill a field, on saving, the invalidFocus should show the focused field clearly in view This patch will center the focused field at the golden section in the window. To test: 1) Begin to add a new patron. 2) Leave a required field empty, which is outside the screen view, and click Save. 3) Notice that the field is at the bottom, behind the language bar if there is one. 4) Apply patch 5) Add a new patron. 6) Leave the required field empty again and Save. 7) Notice that the required field is now clearly shown in view. 8) Sign off. Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
I could see the issue now with the field not being in view, maybe the difference was activating a second language for the staff interface. I've fixed the commit line (it has to be: Bug XXXX: for the QA tools to be happy) and signed off.
Hi Timothy, when starting work on a bug, please don't forget to assign it to yourself.
(In reply to Katrin Fischer from comment #15) > Hi Timothy, when starting work on a bug, please don't forget to assign it to > yourself. Thank you Katrin for reminding me.
This works for me in Firefox, but fails in both Chrome and Chromium - it works for surname, but cardnumber ends up under the save bar
(In reply to Nick Clemens from comment #17) > This works for me in Firefox, but fails in both Chrome and Chromium - it > works for surname, but cardnumber ends up under the save bar Thank you Nick for sending a video showing what happens. Problem at this point is that the interpretation of this command is different between Chrome and Firefox: validator.errorList[0].element.focus();