Thanks for posting this.

I'm having a similar issue. I updated my behavior with your changes, but
still doesn't seem to work on the component in the modal window.

I have a Panel with the FormComponents that is being used on a page and on a
modal window. The Focus Behavior works on the Page, but not the modal
window.

Eric

On Fri, Oct 29, 2010 at 2:17 PM, Stefan Lindner <lind...@visionet.de> wrote:

> Try this:
>
>
> public class FocusBehavior extends AbstractBehavior {
>
>        private static final long serialVersionUID = 1L;
>
>        private Component component;
>
>        @Override
>        public void bind(final Component component) {
>                this.component = component;
>                component.setOutputMarkupId(true);
>        }
>
>        @Override
>        public void renderHead(final IHeaderResponse response) {
>
>  response.renderOnDomReadyJavascript("document.getElementById('" +
> component.getMarkupId() + "').focus();");
>        }
>
> }
>
>
>
> And do
>
>        TextField bla = new Textfield(....);
>        Bla.add(new FocusBeahvior());
>
> Stefan
>
> -----Ursprüngliche Nachricht-----
> Von: Henry, Mike [GCG-PFS] [mailto:mike.he...@primerica.com]
> Gesendet: Freitag, 29. Oktober 2010 19:58
> An: users@wicket.apache.org
> Betreff: set focus in Modal Window
>
> I have successfully set the focus on a text field in a Modal window but
> after it is closed and re-opened it no longer sets the focus to that field.
> If I reload the whole parent page it will work once but again If the modal
> window is closed and re-opened same problem. I have tried all of these with
> the same result:
> target.appendJavascript("document.findRepform.searchString.focus();");
>
> target.focusComponent(((FindRepDetailsPanel)selectModalWindow.get("conte
> nt")).get("findRepform:searchString"));
>
> ((FindRepDetailsPanel)selectModalWindow.get("content")).get("findRepform
> :searchString").add(new DefaultFocusBehavior())
>
>
>
> Any ideas?
>
> Thanks
> Mike
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


-- 
Sent by Eric Hamel

Reply via email to