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">
        <span jwcid="@FieldLabel" field="ognl:components.accountField">
                <label accesskey="a" for="accountField">
                        <span class="accesskey">A</span>ccount
                </label>
        </span>
</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]

Reply via email to