RE: RE: Re: xform:setfocus for redirecting the page
Posted by
Alessandro Vernet on
URL: https://discuss.orbeon.com/xform-setfocus-for-redirecting-the-page-tp42966p42971.html
Prameela,
Prameela R wrote
Able to get the alert but not xforms:load working under initializing events.
So in the portlet, xxforms:script works, but xforms:setfocus and xforms:load don't. As a work-around, you can try this: set an ID on the control on which you want to set the focus, check in the source of the generated HTML what that ID is (it will have a prefix and/or suffix added), and run <xxforms:script>document.getElementById(thatID).focus();</xxforms:script>. If the element is an input, the getElementById() returns the
around the input, so you need to get the input inside the span before you do the focus().
Of course, ideally both xforms:setfocus and xforms:load should work in xforms-model-construct-done for portlets. Issues that happen only in portlet mode tend to have a lesser priority for us right now, so you might want to investigate this yourself if you'd like, and of course if you fix this, please do contribute your change back ;), and we'll make sure to integrate your contribution in the source tree.
Alex