I'm sorry I'm late to reading this thread. The Woodstock team has been
dealing with focus behavior since before they started writing JSF
components. The Woodstock component set handles the focus behavior as
described here:
Perhaps their experience with this topic is of value to this
conversation.
Hi Jim
In some way Jason's proposal seems more natural.
For a component that controls which field should have the focus
when the page is rendered, I see the following possibilities:
a) <f:view focus=#{some.el.returning.a.id}
focusError=#{el.true.or.false}...>
b) <h:form focus=#{some.el.returning.a.id}
focusError=#{el.true.or.false}...>
c) <h:form>
<my:focus ... />
...
</h:focus>
d) <v:view>
<my:focus ... >
<h:form>
...
</h:form>
<h:form>
...
</h:form>
</my:focus>
</f:view>
e) <h:form>
<my:focus ...>
...
</my:focus>
</h:form>
a) is comfortable, but "reasonably do-able" only through corresponding
spec-changes, necessary if we must suppose that more than one
entry form per view is the usual thing
b) is comfortable, but "reasonably do-able" only through corresponding
spec-changes
c) is comfortable, does not need a spec change, can be plugged in
d) is comfortable, does not need a spec change, can be plugged in,
necessary if we must suppose that more than one entry form per view
is the usual thing
e) feeling a bit "awkward"
attributes:
- focus: the id, not the client-id, that would be too cumbersome for
developers,
of the field that should receive the focus
- focusError: true|false If true, then the focus should be set on the
first
field that is connected to an error-message shown on the
view
guess what: we just did something in that way, choosing c) for JSF 1.2
and Facelets
using some code from the Tomahawk-(sandbox ?)
Which, imho, proves the existing need for such a component
regards
Alexander
-----Original Message-----
From: Jim.Driscoll@Sun.COM [mailto:Jim.Driscoll@Sun.COM]
Sent: Tuesday, April 08, 2008 6:00 PM
To: dev@javaserverfaces.dev.java.net
Subject: Re: Setting focus on input fields
Jason Lee wrote:
<foo:focus>
<h:inputText></h:inputText>
</foo:focus>
That would be pretty simple.
Yes, that would be very easy to do. But it seems the
opposite of what I
would expect - and thus ugly.
Am I the only one who feels this way?
Jim
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@javaserverfaces.dev.java.net
For additional commands, e-mail: dev-help@javaserverfaces.dev.java.net
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@javaserverfaces.dev.java.net
For additional commands, e-mail: dev-help@javaserverfaces.dev.java.net