Sebastiaan van Erk wrote:
Johan Compagner wrote:
i still think that behaviors to control focus is a bit wrong
focus should have 1 entry point

I agree.

and i guess that is WebPage.focusComponent()

I agree on that one too.

or maybe Form (but you could have 2)

Exactly, so not a good idea. The page should determine which form gets focus.

By the way we have focus support in ajax mode... see AjaxRequestTarget

johan

It would still be useful to have some strategies for selecting the component to focus lying around, so you can plug them in, e.g., first blank field, first error, etc. These strategies could then work on a form. If you have multiple forms on a page, you'll have to make up your own strategy to choose which form you focus, but you can still use the provided strategies once you've chosen that.

Regards,
Sebastiaan

Thinking about it some more, you probably want to delegate the *choice* of which form field is focused to the form which is selected for focus. That is, page decides which form to focus, form decides which field to focus. That way you can encapsulate complicated focusing behavior in the components themselves instead of having to put it the page. A good default behavior for a page could be to ask the first form in the component hierarchy which field to focus. Another good default is to focus nothing.

Regards,
Sebastiaan


Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to