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

Carl Franks fireartist at gmail.com
Thu Mar 26 18:30:34 GMT 2009


2009/3/26 Ascii King <tech at swattermatter.com>:
> 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');

Ok, I need to change the docs, so get_field() is above get_element() -
as no-one seems to read the description of what the methods do! :)

    $form->get_field( 'repeat_chunk' );

Carl



More information about the HTML-FormFu mailing list