Scroll into view with an onfocus event?
Hi folks
This may be asking too much, but I'll have a go ....
I have a one line grid that I use as a form and in the grid cells I have AW.UI.Input elements. This number of elements is such that the user has to scroll across to complete all form elements (not great user interface design I know, but that's just how it is on this one).
I am using a validation toolkit (fValidate) that, after alerting an input value error returns focus to the offending input element for the user to correct. If the offending element is out of view, I would like the grid to be able to scroll automatically as the element receives focus from the validation tool, so that it is in view for the user.
I can see the methods setScrollLeft and setScrollTop so I figure that I might be able to set an onfocus event handler (using setEvent) for each of the inputs so that when they receive focus the grid would be scrolled to a given position. There are two further considerations, however:
a. I have tried a basic test :
but cannot seem to get anything from this...
(when viewing rendered source I see that each input element has the attribute: onfocus="AW(this, event)", so this maybe overriding what I am trying to do??)
b. even if I can get the above working I think I would need to be able to distinguish between focus obtained by the user (keyboard or mouse) and focus obtained by the validation tool. Not sure if this is possible?
Any thoughts on this much appreciated
Many thanks,
Will
This may be asking too much, but I'll have a go ....
I have a one line grid that I use as a form and in the grid cells I have AW.UI.Input elements. This number of elements is such that the user has to scroll across to complete all form elements (not great user interface design I know, but that's just how it is on this one).
I am using a validation toolkit (fValidate) that, after alerting an input value error returns focus to the offending input element for the user to correct. If the offending element is out of view, I would like the grid to be able to scroll automatically as the element receives focus from the validation tool, so that it is in view for the user.
I can see the methods setScrollLeft and setScrollTop so I figure that I might be able to set an onfocus event handler (using setEvent) for each of the inputs so that when they receive focus the grid would be scrolled to a given position. There are two further considerations, however:
a. I have tried a basic test :
input_element.setEvent("onfocus",function(event){alert("onfocus event happening")});
but cannot seem to get anything from this...
(when viewing rendered source I see that each input element has the attribute: onfocus="AW(this, event)", so this maybe overriding what I am trying to do??)
b. even if I can get the above working I think I would need to be able to distinguish between focus obtained by the user (keyboard or mouse) and focus obtained by the validation tool. Not sure if this is possible?
Any thoughts on this much appreciated
Many thanks,
Will
Will
December 19,