I have a form and few panels in it.
In panel 'A' i have search button , panle 'A' consist of set of other panels
'B'.
panel 'B' has few fields for example field 'F'
Each panel is implemented in sepearate java class
I have requirement wherein after entering text in the field 'F' 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
@Override protected void onInitialize()
{
super.onInitialize();
PnWebForm form = findParent(PnWebForm.class);
if (form != null)
{
form.setDefaultButton(this.pnWebSearchButton);
}
}
Even this did not work and the problem is only with IE8 or its earlier
versions,
it works with Mozilla firefox,chrome,safari etc
Regards
Krishna
--
View this message in context:
http://apache-wicket.1842946.n4.nabble.com/Key-Enter-on-Form-Does-not-work-on-IE8-tp4327083p4327083.html
Sent from the Forum for Wicket Core developers mailing list archive at
Nabble.com.