When a form or a dialog first displays, no control is highlighted. How
do I put the user onto a particular control on a form by default? For example, I have a query dialog that pops up, and I would like the user's cursor to go directly to the input control for typing a name so the user can just type a few letters and press return to perform the query. Thanks, -Jim -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
Administrator
|
<xforms:setfocus control="my-control-id"/> should do the trick. You
can do this upon xforms-ready, or xxforms-dialog-open. This said, it would be nice if you did not have to do this by hand. -Erik On Jun 30, 2008, at 4:35 PM, Jim Logan wrote: > When a form or a dialog first displays, no control is highlighted. > How do I put the user onto a particular control on a form by > default? For example, I have a query dialog that pops up, and I > would like the user's cursor to go directly to the input control for > typing a name so the user can just type a few letters and press > return to perform the query. > > Thanks, > -Jim > > > -- > You receive this message as a subscriber of the [hidden email] > mailing list. > To unsubscribe: mailto:[hidden email] > For general help: mailto:[hidden email]?subject=help > OW2 mailing lists service home page: http://www.ow2.org/wws Orbeon Forms - Web Forms for the Enterprise Done the Right Way http://www.orbeon.com/ -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
Erik Bruchez wrote:
> <xforms:setfocus control="my-control-id"/> should do the trick. You > can do this upon xforms-ready, or xxforms-dialog-open. Works great! Thanks! > > This said, it would be nice if you did not have to do this by hand. That would make a nice option one could set in Orbeon! -Jim -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
In reply to this post by Jim Logan-3
Hi Jim, One way is by the <setfocus> element. It can be a child of an <action> such as for xforms-ready http://www.w3.org/TR/xforms11/#action-setfocus --Hank > When a form or a dialog first displays, no control is highlighted. How > do I put the user onto a particular control on a form by default? For > example, I have a query dialog that pops up, and I would like the user's > cursor to go directly to the input control for typing a name so the user > can just type a few letters and press return to perform the query. > > Thanks, > -Jim > > -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
In reply to this post by Erik Bruchez
Erik Bruchez wrote:
<xforms:setfocus control="my-control-id"/> should do the trick. You can do this upon xforms-ready, or xxforms-dialog-open.In case anyone's interested, I've created a generic procedure for selecting and activating a button when the user presses return in an input control. You still have to do this by hand, but I find it a little less painful. Here's an example of how to call it: <xforms:input id="version-label" ref="instance('new-version')/v:Data_asset_version/rdfs:label">When the user presses return, the DOMActivate event fires. The dispatch element activates on this event, adds a property to my accept-and-activate event, representing the button I want to press for the user, and dispatches my event to the main-model. (Note that the @select attribute has double and single quotes, which makes 'create-and-add-version' a literal value rather than a path to a value in an XML instance.) Here's the procedure itself: <xforms:model id="main-model">This action lives in the main-model and activates when I dispatch the accept-and-activate event. It pulls the event property out into a variable representing the button I want to press, sets the focus to that button, and activates it. This procedure is almost a wash. It has one fewer line of XForms code than embedding the elements directly, but it requires fewer pastes of the target name. I think it makes for fewer typos and provides a simple example of how to define and use a procedure in XForms. I hope someone else finds it useful. -Jim -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
Free forum by Nabble | Edit this page |