Hi,

lucast wrote:
> Dear Forum,
> Currently, I make heavy use of TextField.setLabel().
> If adding a css field to TextField is as easy as TextField.add(new
> AttributeAppender("class", " TestCSSClass ")); then:
> 
> How can I add a CSS class to <label> that has been created for TextField?

I don't think that TestField#setLabel has anything to do with markup
generation -- it won't generate a <label> tag. Instead, it is used for
validation messages "...${label}..." (see javadoc).

Just use regular HTML in your markup file:
<label wicket:for="yourtextfield"><wicket:message
key="label.yourtextfield">Your Textfield</wicket:message></label>
<input type="text" wicket:id="yourtextfield">

The wicket:message stuff is Wicket's I18N and not strictly required.
However, using it, you can use a StringResourceModel as the argument to
setLabel to get the same property value, so your label in the
markup/HTML corresponds to the label displayed in validation error messages.

> 
> Thanks in advance,
> Lucas

Hope this helps, bye,
    Stefan
> 
> --
> View this message in context: 
> http://apache-wicket.1842946.n4.nabble.com/is-it-possible-to-add-a-css-class-to-FormComponent-setLabel-tp4666801.html
> Sent from the Users forum mailing list archive at Nabble.com.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> 

-- 
im Auftrag der eFonds Solutions AG, +49-89-579494-3417


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to