Tapestry
  1. Tapestry
  2. TAPESTRY-974

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

    Details

    • 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:
      None

      Description

      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.

        Activity

        No work has yet been logged on this issue.

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development