[html-formfu] Different attributes for the first record in a repeatable block

Ascii King tech at swattermatter.com
Thu Mar 26 17:35:14 GMT 2009


Thanks for your help so far. I have the first-child working but it isn't 
exactly what I need. I have some javascript code that allows me to 
dynamically add rows to repeatable elements. However, it refers to the 
rows by classname and id. I need to be able to make the first or last 
row in the repeatable a different class.

Is it possible to assign a class to a div tag through code? I can't get 
hold of the tag because it is a field, I think. And get_element is not 
for common use? (plus it doesn't work)

    $Repeat_field = $form->get_element({ name => 'repeat_chunk' });
    $Repeat_field->attributes('class' => 'foo');


Carl Franks wrote:
> 2009/3/26 Ascii King <tech at swattermatter.com>:
>   
>> I believe the output of a Repeatable is wrapped in div tag. I use the
>> following code to generate a div tag.
>>
>>   - type: Repeatable
>>     nested_name: appointments
>>     counter_name: appointment_count
>>     attributes:
>>       class: ShawnTest
>>       id: appointment_count
>>     elements:
>>
>> This outputs:
>> <div class="ShawnTest" id="appointment_count">
>>
>> This is wrapped around all of the elements in the Repeatable block.
>>     
>
> That surrounds each individual repeat - but there's no tag containing
> all the repeats - which is what you'd need for first-child to work.
>
> Carl
>
> _______________________________________________
> HTML-FormFu mailing list
> HTML-FormFu at lists.scsys.co.uk
> http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu
>
>   



More information about the HTML-FormFu mailing list