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

Hu Hailin i at h2l.name
Tue Jun 22 08:45:38 GMT 2010


Hi,

Let me try to make an example:

a employee search page and can be searched by department.
Suppose there are hundreds of departments, showing a very long
multiple selectable select element seems not a good idea.
I try to make the page only take departments' id from query and
display the departments' info in the page.

Even if use a block element, hundreds of departments info have to be
listed in page, right?

Well, it seems I have to serialize data...

Thank you, guys.

On Tue, Jun 22, 2010 at 5:08 PM, Carl Franks <fireartist at gmail.com> wrote:
> 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
>>
>
> _______________________________________________
> HTML-FormFu mailing list
> HTML-FormFu at lists.scsys.co.uk
> http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu
>



-- 
islue



More information about the HTML-FormFu mailing list