the question is, how exactly you want to track the changing of focus?
-Matej
Johan Compagner wrote:
if i have an ajax behavior on a text field event: onfocus
and i set the background and then add that component to the ajax event for
redraw
then i loose focus. Ofcourse there are ways to go
yes, tracking is easy with our new event thing :)
get on it matej!
-igor
On 2/19/07, Johan Compagner [EMAIL PROTECTED] wrote:
attach an onfocus event on all focusable components
then have a javascript variable in the page that gets that assigned
input type=text
well we have the new Wicket.Event thing you can use to install events. so
really what you do is create a javascript variable, then install a
'domready' event that traverses the dom tree looks for formcomponents and
adds an onfocus event. then we just need to make the ajax stuff aware of
this.
What i want is this:
component.add(new ajaxbehaviour(onfocus))
then in the onEvent i do
ajaxtarget.add(component)
but then the focus is gone.
So what should happen is that the focus is tracked on the page
and when a ajax request comes back then it does focus() again.
What we also can do is
if you want something specific then you can already do ajaxtarget.focus()
ajaxtarget.appendjavascript(document.getelementbyid
('+c.getmarkupid()+').focus();)
if you want this more general so it works transparently its trickier. then
like you said you need to keep track of focus in a var and
that would be the best thing
because doing it serverside is a bad thing
because the user could already be jumping to another field and then
it always is restored to the one you think it is on the serverside
The best thing is attaching it on the onfocus event on the client side
and record it.
and