1. Tapestry
  2. TAPESTRY-974

Modify ValidationDelegate or FieldLabel so it allows markup to be written inside <label>


    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 4.0.2
    • Fix Version/s: 4.1.1
    • Component/s: Framework
    • Labels:


      Copied from the following thread:


      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.

      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.


        Mark Thomas made changes -
        Workflow Default workflow, editable Closed status [ 12568909 ] jira [ 12590189 ]
        Mark Thomas made changes -
        Workflow jira [ 12372720 ] Default workflow, editable Closed status [ 12568909 ]
        Jesse Kuhnert made changes -
        Assignee Jesse Kuhnert [ jkuhnert ]
        Resolution Fixed [ 1 ]
        Fix Version/s 4.1.1 [ 12312021 ]
        Status Open [ 1 ] Resolved [ 5 ]
        Matt Raible made changes -
        Field Original Value New Value
        Attachment FieldLabel.java [ 12334915 ]
        Matt Raible created issue -


          • Assignee:
            Jesse Kuhnert
            Matt Raible
          • Votes:
            0 Vote for this issue
            0 Start watching this issue


            • Created: