Frank Re. solution proposed below (with FocusBehavior) you can get the
markup id for whatever field you chose determined by how you write your
getDefaultField() method in the class implementing the interface
FocusBehaviour. One option would be to have the method traverse all relevant
form components checking their model objects for values and then return
markup for whichever one you like. You may even want to append each valid
selection into a list and use that as the basis for a rule on which gets the
focus. Hope this helps you formulate a strategy.

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Frank Bille
Sent: 15 June 2007 10:07
To: wicket-user@lists.sourceforge.net
Subject: Re: [Wicket-user] Best way to set the focus on a form's TextField


(Link a little long so here's a shorter one: http://tinyurl.com/3d9sja
<http://tinyurl.com/3d9sja> )

Frank


On 6/15/07, Frank Bille < [EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]> > wrote: 

I have been playing around with it as well. Untill now I have come up with
the following: 

http://svn.teachus.dk/browse/TeachUs/dk.teachus/trunk/teachus-frontend/src/m
ain/java/dk/teachus/frontend/components/form/DefaultFocusBehavior.java?r=roo
t
<http://svn.teachus.dk/browse/TeachUs/dk.teachus/trunk/teachus-frontend/src/
main/java/dk/teachus/frontend/components/form/DefaultFocusBehavior.java?r=ro
ot> :

But I'm not entirely sure it does what I want. I would also like to be able
to attach it to more than one field and then it's the first field without a
value that receives focus. Perhaps.. 

Frank



On 6/15/07, Seldon, Richard <  <mailto:[EMAIL PROTECTED]>
[EMAIL PROTECTED]> wrote:


Would be interested to know of any "standard way" to handle this but it is
easy enough to roll your own with a few lines of code. Perhaps try the
following:
 
1) Set up a FocusBehavior interface that provides a getDefaultField()
method.
2) Create a SetFocusVisitor that implements wicket.Component.IVisitor and
traverses child nodes looking for FocusBehaviour
3) Get the markup id from component implementing FocusBehavior and use
bodycontainer to append DOM node lookup into body element onload attribute
by 4) calling getElementByid(yourMarkup).focus()

 
 

-----Original Message-----
From: [EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>  [mailto:
[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]> ]On Behalf Of Francisco
Diaz Trepat - gmail
Sent: 14 June 2007 21:58
To: wicket-user@lists.sourceforge.net
<mailto:wicket-user@lists.sourceforge.net> 
Subject: [Wicket-user] Best way to set the focus on a form's TextField


Hi all, 
 
I have a login form and want to set the focus on the user name field as soon
as it is displayed. As it is to say on the document load event.
 
I've read some on nabble but it didn't quite understand the best way.
 
Can someone guide me a bit?
 
Best regards,
 
f(t)
 
ps: elco elco please the book, elco elco pleae the book </cantito_argentino>



This e-mail (and any attachments) may contain privileged and/or confidential
information. If you are not the intended recipient please do not disclose,
copy, distribute, disseminate or take any action in reliance on it. If you
have received this message in error please reply and tell us and then delete
it. Should you wish to communicate with us by e-mail we cannot guarantee the
security of any data outside our own computer systems. For the protection of
Legal & General's systems and staff, incoming emails will be automatically
scanned. 

Any information contained in this message may be subject to applicable terms
and conditions and must not be construed as giving investment advice within
or outside the United Kingdom.

The following companies are subsidiary companies of the Legal & General
Group Plc which are authorised and regulated by the Financial Services
Authority for advising and arranging the products shown: Legal & General
Partnership Services Limited (insurance and mortgages), Legal & General
Insurance Limited (insurance), Legal & General Assurance Society Limited 
(life assurance, pensions and investments), Legal & General Unit Trust
Managers Limited and Legal & General Portfolio Management Services Limited
(investments).

They are registered in England under numbers shown.
The registered office is Temple Court, 11 Queen Victoria Street, London EC4N
4TP.

Legal & General Partnership Services Limited: 5045000 Legal & General
Assurance Society Limited: 166055 Legal & General (Unit Trust Managers)
Limited: 1009418 Legal & General (Portfolio Management Services) Limited:
2457525 Legal & General Insurance Limited: 423930 

They are registered with the Financial Services Authority under numbers
shown. You can check this at www.fsa.gov.uk/register
<http://www.fsa.gov.uk/register> 

Legal & General Partnership Services Limited: 300792 Legal & General
Assurance Society Limited: 117659 Legal & General (Unit Trust Managers)
Limited: 119273 Legal & General (Portfolio Management Services) Limited:
146786 Legal & General Insurance Limited: 202050 


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now. 
http://sourceforge.net/powerbar/db2/ <http://sourceforge.net/powerbar/db2/> 
_______________________________________________
Wicket-user mailing list 
Wicket-user@lists.sourceforge.net <mailto:Wicket-user@lists.sourceforge.net>

https://lists.sourceforge.net/lists/listinfo/wicket-user
<https://lists.sourceforge.net/lists/listinfo/wicket-user> 





-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to