Re: use AjaxFormComponentUpdatingBehavior for ENTER-handling

2009-03-18 Thread alexander.elsholz

hi,

so i solved the problem, biut i have to copy some code from
AjaxFormComponentUpdatingBehavior, because of the getEventHandler() is
final.



new AjaxFormComponentUpdatingBehavior("onkeypress") {

@Override
protected void onComponentTag(ComponentTag 
pTtag) {
Component myComponent = getComponent();
if (myComponent.isEnabled()
&& 
myComponent.isEnableAllowed()) {
CharSequence handler = 
generateCallbackScript(new
AppendingStringBuffer(

"wicketAjaxPost('").append(

getCallbackUrl(false)).append(
"', 
wicketSerialize(Wicket.$('"

+ getComponent().getMarkupId() + "'))"));

String event = "if 
(event.keyCode == 13) {"
+ 
handler.toString() + "}";

pTtag.put("onkeypress", event);
}
}

@Override
protected void onUpdate(AjaxRequestTarget 
pTarget) {
//do sth here
}

});
}

it works, but the copied code is awful. is there an other possibility?

thanks alex


alexander.elsholz wrote:
> 
> hi,
> 
> here
> http://www.nabble.com/Form-Enter-Key-Problem-td14408121.html#a18785052
> Juan Gabriel Arias described how to submit a field on enter. 
> how can i combine this with AjaxFormComponentUpdatingBehavior, where 
> getEventHandler() is final?
> 
> thanks alex
> 

-- 
View this message in context: 
http://www.nabble.com/use-AjaxFormComponentUpdatingBehavior-for-ENTER-handling-tp22486032p22576961.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



use AjaxFormComponentUpdatingBehavior for ENTER-handling

2009-03-12 Thread alexander.elsholz

hi,

here http://www.nabble.com/Form-Enter-Key-Problem-td14408121.html#a18785052
Juan Gabriel Arias described how to submit a field on enter. 
how can i combine this with AjaxFormComponentUpdatingBehavior, where 
getEventHandler() is final?

thanks alex
-- 
View this message in context: 
http://www.nabble.com/use-AjaxFormComponentUpdatingBehavior-for-ENTER-handling-tp22486032p22486032.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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