use FormComponentUpdatingBehavior instead

-igor

On Wed, Jan 18, 2012 at 2:12 AM, Krishna Mohan
<k.krishnamoha...@gmail.com> wrote:
> I have a form, few panels in it.
>
> In one of the panel i have few fields and in other panel a search button.
>
> I have requirement wherein after entering text in the field on press of 
> "Enter"
> button search should be performed with out click of search button.
>
> To achieve this i tried following snippet
>
>  add(new AjaxEventBehavior("onkeypress")
>      {
>        @Override protected CharSequence getCallbackScript(boolean
> onlyTargetActivePage)
>        {
>          return generateCallbackScript("wicketAjaxGet('" +
> getCallbackUrl(onlyTargetActivePage) + "&" + KEYPRESS_PARAM +
> "='+wicketKeyCode(event)");
>        }
>
>
>        @Override protected void onEvent(AjaxRequestTarget target)
>        {
>          String paramValue =
> RequestCycle.get().getRequest().getParameter(KEYPRESS_PARAM);
>  int key = Integer.parseInt(paramValue);
>            if (key == 13)
>            {
>               submitSearchForm();
>             }
>        }
>
>    });
> but using above the text in the field is cleared and get wrong search. but 
> when
> i remove focus from the field and press "Enter" i get desired result.
>
> My question here is how to perform search, remaining in the field(with focus 
> in
> the field)
>
> or their any other approach to get my requirement
>
> i also tried
>  Form form = findParent(Form.class);
>    if (form != null)
>    {
>      form.setDefaultButton(searchButton);
>    }
>
> but form is always null for me
>
> Regards
> Krishna
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to