[html-formfu] Incremental id for repeatable element

Ascii King tech at swattermatter.com
Fri Jan 23 17:31:46 GMT 2009


Is it poosible to specify a different characteristic for the first 
record in a set? I would like the class in the first repeatable block to 
be different from the rest of the class tags. Something like a 
first_record_attributes option.


    - type: Repeatable
      nested_name: gg
      counter_name: thecount
      first_record_attributes:
        class: outer-ring
      attributes:
        class: inner-ring
      elements:

      - type: Hidden
        name: the_key

      - type: Text
        name: the_date

The above code would produce the desired output shown below. 
"outer-ring" and "inner-ring" are the only differences.

<div class="outer-ring">
  <input name="gg.the_key_0" value="3" id="gg.the_key_0" type="hidden">

  <div class="text label">
    <input name="gg.the_date_0" value="2008-10-21" id="gg.the_date_0" 
type="text">
  </div>
</div>

<div class="inner-ring">
  <input name="gg.the_key_1" value="5" id="gg.the_key_1" type="hidden">

  <div class="text label">
    <input name="gg.the_date_1" value="2008-11-13" id="gg.the_date_1" 
type="text">
  </div>
</div>

<div class="inner-ring">
  <input name="gg.the_key_2" value="6" id="gg.the_key_2" type="hidden">

  <div class="text label">
    <input name="gg.the_date_2" value="2008-11-15" id="gg.the_date_2" 
type="text">
  </div>
</div>



More information about the HTML-FormFu mailing list