I am using a behavior that is dynamically added/removed from a TextField based upon another components state (in order to avoid extra round trips to the server):
final AjaxFormComponentUpdatingBehavior afcub = ... final TextField textField = new TextField("some-id", new Model()){ protected final void onBeforeRender() { boolean hasBehavior = false; for (final IBehavior b : (List<IBehavior>) component.getBehaviors()) { if (b.equals(behavior)) { hasBehavior = true; break; } } // is add flag is captured by another components conditions to avoid server round-trips if (isAddFlag && !hasBehavior) { add(afcub); } else if(!isAddFlag && hasBehavior) { remove(afcub); } super.onBeforeRender(); } } Using the code above I get an IllegalStateException when the AjaxFormComponentUpdatingBehavior is added, then removed, and added again (all based on user interaction of course). In AbstractAjaxBehavoir there is a method that does a (component != null) check... shouldn't that check be (component != null && !(component.equals(hostComponent))) to avoid this type of scenario? public final void bind(final Component hostComponent) { if (hostComponent == null) { throw new IllegalArgumentException("Argument hostComponent must be not null"); } if (component != null) { throw new IllegalStateException("this kind of handler cannot be attached to " + "multiple components; it is already attached to component " + component + ", but component " + hostComponent + " wants to be attached too"); } component = hostComponent; // call the callback onBind(); } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]