You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by mraible <ma...@raibledesigns.com> on 2007/09/13 21:23:47 UTC
Re: Customizing ValidationDelegate with writeLabelAttributes
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: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Customizing ValidationDelegate with writeLabelAttributes
Posted by mraible <ma...@raibledesigns.com>.
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 <ma...@raibledesigns.com> 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: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
>
--
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: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Customizing ValidationDelegate with writeLabelAttributes
Posted by Johan Maasing <jm...@gmail.com>.
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 <ma...@raibledesigns.com> 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: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Customizing ValidationDelegate with writeLabelAttributes
Posted by Igor Drobiazko <ig...@gmail.com>.
Hi Matt,
here is what we did for our project:
http://bookie.googlecode.com/svn/trunk/bookie-framework/src/main/java/org/bookie/framework/CustomDelegate.java
Hope this helps.
Regards
Igor
On 9/13/07, mraible <ma...@raibledesigns.com> 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: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>