You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by "Matt Raible (JIRA)" <ta...@jakarta.apache.org> on 2006/06/02 00:31:30 UTC

[jira] Updated: (TAPESTRY-974) Modify ValidationDelegate or FieldLabel so it allows markup to be written inside

     [ http://issues.apache.org/jira/browse/TAPESTRY-974?page=all ]

Matt Raible updated TAPESTRY-974:
---------------------------------

    Attachment: FieldLabel.java

While I don't mind providing my own custom FieldLabel, it is unfortunate that I have to copy ValidMessages.java from the Tapestry source tree. This file is package-protected, so it has no visibility to classes outside of Tapestry.

> Modify ValidationDelegate or FieldLabel so it allows markup to be written inside <label>
> ----------------------------------------------------------------------------------------
>
>          Key: TAPESTRY-974
>          URL: http://issues.apache.org/jira/browse/TAPESTRY-974
>      Project: Tapestry
>         Type: Bug

>   Components: Framework
>     Versions: 4.0.2
>     Reporter: Matt Raible
>  Attachments: FieldLabel.java
>
> Copied from the following thread:
> http://www.nabble.com/Issues+with+Label+Components+with+Tapestry+4.0-p4576155.html
> <issue>
> I'm overriding ValidationDelegate in order to add required field
> indicators.  I used to be pre-pending an asterisk to the beginning of
> the field, and I had that working.  Now I want to add <span class="req">
> to the end of the <label> before the </label> shows up.  I'm using
> @FieldLabel and everything *almost* works. I've eliminating error
> styling in the class below so it's easier to read.
> public class Validator extends ValidationDelegate {
>     public void writeLabelSuffix(IFormComponent component,
>                                  IMarkupWriter writer, IRequestCycle
> cycle) {
>         if (component.isRequired()) {
>             writer.begin("span");
>             writer.attribute("class", "req");
>             writer.printRaw(" *");
>             writer.end();
>         }
>     }
> The code above results in <label>blah blah</label><span class="req">
> *</span>, when I'd rather have the <span> w/in the <label>.  I tried
> overriding writeLabelAttributes(), but that doesn't seem to allow me to
> create a new tag and write it out w/in the label.
> </issue>
> The only way to achieve this functionality currently is to override FieldLabel and change the order of when things are written.  I'll attach my custom FieldLabel to demonstrate the functionality I'm looking for.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org