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

Ascii King tech at swattermatter.com
Tue Mar 31 17:44:32 BST 2009


That works great! Thank you.  How do I count the number of elements 
returned by the get_all_element function?

$form->get_all_element({ type => Repeatable })

If I display the variable, I can see that I get four elements, but I 
don't know how to count them with code.

Carl Franks wrote:
> 2009/3/30 Ascii King <tech at swattermatter.com>:
>
>   
>>> I suspect what's happening here is that the rep blocks aren't getting
>>> the 'name' copied over.
>>> If you use Data::Dumper, you should be able to confirm that.
>>> If that's the case, could you commit a fix?
>>>
>>> Cheers,
>>> Carl
>>>
>>>       
>> So, I'm not  a great programmer, but here is what I have.  The
>> get_all_element() works for div tags outside of the repeatable element as
>> you said. It fails to grab div tags inside the repeatable but will grab
>> input elements inside repeatables.
>>
>> I have Data Dumper dumping the form variable and the variable I use to store
>> the get_all_element() but I can't tell what all of the data is for.  I'll
>> test the Repeatable.pm code at some point to see if I can fix it.
>>     
>
> I'm pretty sure it'll be the name issue I mentioned.
>
> Alternatively, you can grab the first repeat with
>     $form->get_all_element({ type => Repeatable })->get_element();
> or any other repeat using
>     $form->get_all_element({ type => Repeatable })->get_elements->[1]; # etc
>
> 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