There seems to be a bug in 4.1.3 in that if you have "class" defined on your
label, the code below won't overwrite or append to it. I think TAPESTRY-975
needs to be re-opened.

https://issues.apache.org/jira/browse/TAPESTRY-975

Matt


Johan Maasing-2 wrote:
> 
> Not exactly what you are trying to do but for my project this was
> sufficient.
> 
> public void writeLabelAttributes(IMarkupWriter writer, IRequestCycle
> cycle,
>               IFormComponent component) {
>       if (isInError()) {
>               writer.attribute("class", "fielderror");
>       }
> }
> 
> I styled my fieldlabels by styling the enclosing tags:
> 
> <td class="fieldlabel">
>       
>               <label accesskey="a" for="accountField">
>                       Account
>               </label>
>       
> </td>
> 
> 
> On 9/13/07, mraible <[EMAIL PROTECTED]> wrote:
>>
>> Has anyone written their own ValidationDelegate implementation that
>> manipulates the CSS class of the component's FieldLabel?
>>
>> Thanks,
>>
>> Matt
>>
>>
>> mraible wrote:
>> >
>> > I have a @FieldLabel that's written as follows:
>> >
>> > <label class="desc" jwcid="@FieldLabel"
>> > field="component:usernameField">Username</label>
>> >
>> > When the "usernameField" has an error, I want to change the class to
>> "desc
>> > error" or just "error". I've created my own ValidationDelegate and
>> tried
>> > to overwrite writeLabelAttributes(), but it doesn't seem to work.
>> >
>> > Is there something I'm doing wrong in the code below?
>> >
>> >     public void writeLabelAttributes(IMarkupWriter writer,
>> IRequestCycle
>> > cycle, IFormComponent component) {
>> >         if (isInError(component)) {
>> >             writer.appendAttribute("class", "error");
>> >         }
>> >     }
>> >
>> > Thanks,
>> >
>> > Matt
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Customizing-ValidationDelegate-with-writeLabelAttributes-tf4349798.html#a12661641
>> Sent from the Tapestry - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Customizing-ValidationDelegate-with-writeLabelAttributes-tf4349798.html#a12663093
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to