[html-formfu] nested_name and order_by

Carl Franks fireartist at gmail.com
Wed Jun 23 12:54:20 GMT 2010


On 23 June 2010 12:11, Benjamin Martin <benjamin at opusvl.com> wrote:
> Hello,
>
> I am using a Repeatable element to build a form based on a DBIx::Class
> object and its has_many relationship. (using 'nested_name')
>
> My config looks something like this:
>
>      - type: Text
>        name: persons_name
>
>      - type: Hidden
>        name: requests_counter
>
>      - type: Repeatable
>        nested_name: requests
>        counter_name: requests_counter
>        elements:
>          - type: Hidden
>            name: id
>
>          - type: Text
>            name: request_date
>
> It works real well but I can't seem to get the form to list the related
> items in a defined order?
>
> I guess i need something like:
>
>      - type: Text
>        name: persons_name
>
>      - type: Hidden
>        name: requests_counter
>
>      - type: Repeatable
>        nested_name: requests
>        counter_name: requests_counter
>        model_config:
>          attributes:
>            order_by: request_date
>        elements:
>          - type: Hidden
>            name: id
>
>          - type: Text
>            name: request_date
>
> Could anyone please tell me if this is possible and if so what am I doing
> wrong?

This isn't implemented at the moment.
However, the options_from_model() method already supports
{model_config}{attributes}, so I'd certainly accept a patch that adds
it for default_values().

Carl



More information about the HTML-FormFu mailing list