[ https://issues.apache.org/jira/browse/WICKET-4463?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13236481#comment-13236481 ]
Martin Grigorov commented on WICKET-4463: ----------------------------------------- Hi Serban, I think you actually benefit from this warning. I guess your code looks like: AjaxLink l = new AjaxLink() {...}; l.add(new ConfirmBehavior()); parent.add(link); If this is the case then ConfirmBehavior is added before AjaxEventBehavior because the latter is added in AjaxLink#onInitialize(). So tag.getAttributes().getString("onclick"); should always return "null" for you, no ? AjaxEventBehavior#onComponentTag() logs this warning only if there is some value already for the event it manipulates. Because it completely ignores the old value and replaces with the result of org.apache.wicket.ajax.AjaxEventBehavior#getEventHandler(). > Maybe there are several Ajax event behaviors on the same type assigned to > this component > ---------------------------------------------------------------------------------------- > > Key: WICKET-4463 > URL: https://issues.apache.org/jira/browse/WICKET-4463 > Project: Wicket > Issue Type: Bug > Components: wicket > Affects Versions: 1.5.5 > Reporter: Serban Balamaci > Priority: Minor > > I don't know if this is actually an issue, just wanted to know let you know > what the recent > http://apache-wicket.1842946.n4.nabble.com/Log-a-warning-when-there-are-several-ajax-event-behaviors-on-the-same-event-td4413925.html > change impacted. > We are now seeing: > WARN (org.apache.wicket.ajax.AjaxEventBehavior:120) - > org.apache.wicket.ajax.markup.html.AjaxLink$1 {event='onclick'} assigned to [ > [Component id = delete]] is overriding the previous value of the inline > attribute. Maybe there are several Ajax event behaviors on the same type > assigned to this component. > Because we have an AjaxLink with added ConfirmBehavior that does not > "replace" but "enhances" by appending to a behaviour: > ConfirmBehavior extends Behavior { > @Override > public void onComponentTag(Component component, ComponentTag tag) { > StringBuilder handler = new StringBuilder(128); > handler.append("if (!confirm('"); > handler.append(message.getObject()); > handler.append("')) {return false;} "); > String script = tag.getAttributes().getString("onclick"); > if (script != null) { > handler.append(script); > } > tag.put("onclick", handler.toString()); > } > } > we can/should probably change it to an AjaxCallDecorator, just wanted to let > others know what the change > http://apache-wicket.1842946.n4.nabble.com/Log-a-warning-when-there-are-several-ajax-event-behaviors-on-the-same-event-td4413925.html > might affect. > Thanks. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira