Hi,

Two alternative solutions:

- If you want the CSS class be appened only in one response then set the AttributeAppender as "temporary"
...new AttributeAppender(...) {
    @Override
    isTemporary() { return true} }
}...
- Or disable/enable AttributeAppender as needed by overriding isEnabled() method of it:
...new AttributeAppender(...) {
    @Override
    isEnabled() { return inputComponent.getFeedbackMessage() != null }
}...


Cheers,
Zoltan


On 06/16/2010 07:48 AM, David Chang wrote:
Jeremy, glad to hear from you!

My situation is a little different. The CSS class is added in the following 
way. Please see the following code.

        protected void onBeforeRender() {
                super.onBeforeRender();
                if (inputComponent.getFeedbackMessage() != null) {
                        inputComponent.add(new AttributeAppender("class", new 
Model<String>("errorField"), " "));
                } else {
                        // how to remove CSS class here??                       
                }
        }


Thanks!


--- On Wed, 6/16/10, Jeremy Thomerson<jer...@wickettraining.com>  wrote:

From: Jeremy Thomerson<jer...@wickettraining.com>
Subject: Re: How to remove css class from a component?
To: users@wicket.apache.org
Cc: "John Krasnay"<j...@krasnay.ca>
Date: Wednesday, June 16, 2010, 1:40 AM
onComponentTag(...) {
tag.remove("class");
}

On Wed, Jun 16, 2010 at 12:37 AM, David Chang<david_q_zh...@yahoo.com>wrote:

Hello,

I add a CSS class to component dynamcially the
following way:
inputComponent.add(new AttributeAppender("class", new
Model<String>("errorField"), " "));

How can I remove this CSS class in java code?

Best!





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



--
Jeremy Thomerson
http://www.wickettraining.com




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



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

Reply via email to