[html-formfu] set multiple values to hidden element?

Carl Franks fireartist at gmail.com
Tue Jun 22 08:08:05 GMT 2010


Hi,

A hidden field won't support multiple values, so you'd need to
serialize them yourself - for example with JSON.
    $field->default( encode_json( $value ) );

I'd recommend though, just using Block elements, as it's very easy to
attach IDs or class-names, which your JavaScript can target to
show/hide the blocks.

Carl


On 22 June 2010 08:19, Hu Hailin <i at h2l.name> wrote:
> Hi
>
> My situation is that I have so large a form that I try to split some
> condition out to display them in a collapsible div with javascript.
> So I am trying to pass data using Element::Hidden, but it accepts
> first value and fills it in form in multiple values' case.
> I also glanced at Element::Repeatable which seems not the one I want...
>
> Yes, it might be implemented using blocks but a little too complex.
> Any advice for implementing a repeatable hidden element?
>
> Thanks.
> --
> islue
>
> _______________________________________________
> 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