You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Kenneth NA <ri...@live.se> on 2009/07/12 22:57:08 UTC

Is it possible to register multiple behaviors for a field?

 
I want to register two behaviors for a textfield, is this possible, as I only see the result and call to one of them? 


This is what I am trying to do: 
textfield.add(new ComponentVisualErrorBehavior("onblur", tf));
textfield.add(new AjaxFormComponentUpdatingBehavior("onblur") { ... }



_________________________________________________________________
Vårkänslor och pirr i magen? Hitta din drömpartner här!
http://dejting.se.msn.com/channel/index.aspx?trackingid=1002952

Re: Is it possible to register multiple behaviors for a field?

Posted by Martin Makundi <ma...@koodaripalvelut.com>.
You could use ajax decorator which sort of appends callers.. I am not
exactly sure how in your particular situation, but you can try it out
and see how it works:

  public static final IAjaxCallDecorator BLUR_DECORATOR = new
IAjaxCallDecorator() {
    public CharSequence decorateOnFailureScript(
        CharSequence arg0) {
      return arg0;
    }

    public CharSequence decorateOnSuccessScript(
        CharSequence arg0) {
      return arg0;
    }

    public CharSequence decorateScript(CharSequence arg0) {
      return "blur();" + arg0;
    }
  };

Usage:
component.add(new
OnChangeAjaxBehavior() {
@Override
protected void onUpdate(AjaxRequestTarget target) {
target.addChildren(dailyContainer, DropDownChoice.class);
}
/**
* @see
org.apache.wicket.ajax.AbstractDefaultAjaxBehavior#getAjaxCallDecorator()
*/
@Override
protected IAjaxCallDecorator getAjaxCallDecorator() {
return BLUR_DECORATOR;
}
});

**
Martin

2009/7/12 Kenneth NA <ri...@live.se>:
>
>
> I want to register two behaviors for a textfield, is this possible, as I only see the result and call to one of them?
>
>
> This is what I am trying to do:
> textfield.add(new ComponentVisualErrorBehavior("onblur", tf));
> textfield.add(new AjaxFormComponentUpdatingBehavior("onblur") { ... }
>
>
>
> _________________________________________________________________
> Vårkänslor och pirr i magen? Hitta din drömpartner här!
> http://dejting.se.msn.com/channel/index.aspx?trackingid=1002952

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