[Zend_Form] howto: multiCheckbox with collapsible lower elements‏

5 messages Options
Embed this post
Permalink
Exception e

[Zend_Form] howto: multiCheckbox with collapsible lower elements‏

Reply Threaded More More options
Print post
Permalink
I create a series of checkboxes in a multiCheckbox element from Zend_Form. These checkboxes are rendered in one definition list.
Since this list is too long, I want to be able to collapse the lower part of the list.

I can imagine two solutions.

  1. Generate two different definition lists, put adiv in between
  2. Generate a single definition list, with the lower part nested in a dd. Example:


<dl>
	<dt>one</dt>
	<dd>checkbox</dd>
	<dt>two</dt>
	<dd>checkbox</dd>
	<dt>..</dt>
	<dd>checkbox</dd>
	<dt>show more</dt>
	<dd>
		<dl>
			<dt>six</dt>
			<dd>checkbox</dd>
			<dt>seven</dt>
			<dd>checkbox</dd>
			<dt>..</dt></dd>
		</dl>
	</dd>
</dl>

I don't know what is semantically more correct.
Anyways, my question is: how can I solve this in Zend_Form?

  1. Is this what displaygroups are for?
  2. Do I need to extend the FormElements decorator? How? With a different View script?
  3. other way...?

I am a bit puzzled by the complexity and possibilities of Zend_Form. What is best practice? Any help is greatly appreciated.
Jurian Sluiman

Re: [Zend_Form] howto: multiCheckbox with collapsible lower elements‏

Reply Threaded More More options
Print post
Permalink
Some javascript/style in this post has been disabled (why?)
With the display-group you could render things like fieldset (but also any other element).

I think what you want is dynamic behaviour which shouldn't be done with html/css. This is behaviour meant for javascript. With the jQuery view helper it's really easy to accomplish.


Regards, Jurian
--
Jurian Sluiman
Soflomo.com


Op Saturday 24 October 2009 15:33:57 schreef Exception e:
> I create a series of checkboxes in a multiCheckbox element from Zend_Form.
> These checkboxes are rendered in one definition list.
>
> Since this list is to long, I want to be able to collapse the lower part of
> the list.
>
>
> I can imagine two solutions.
>
>
> Generate two different definition lists, put adiv in between
> Generate a single definition list, with the lower part nested in a dd.
> Example:
>
>
>
>
>
>
> one
> checkbox
> two
> checkbox
> ..
> checkbox
> show more
>
>
> six
> checkbox
> seven
> checkbox
> ..
>
>
>
>
>
>
>
>
> I don't know what is semantically more correct.
>
> Anyways, my question is: how can I solve this in Zend_Form?
>
>
> Is this what displaygroups are for?
> Do I need to extend the FormElements decorator? How? With a different View
> script?
> other way...?
>
>
> I am a bit puzzled by the complexity and possibilities of Zend_Form. What
> is best practice? Any help is greatly appreciated.



signature.asc (204 bytes) Download Attachment
Exception e

Re: [Zend_Form] howto: multiCheckbox with collapsible lower elements‏

Reply Threaded More More options
Print post
Permalink
Jurian Sluiman wrote:
With the display-group you could render things like fieldset (but also any
other element).

I think what you want is dynamic behaviour which shouldn't be done with
html/css. This is behaviour meant for javascript. With the jQuery view helper
it's really easy to accomplish.
Display-group lends itself for easy wrapping. But a subform would do the same trick isn't it? Okay, that's less efficient of course.
As I understand now, the purpose of a DisplayGroup is make it easy to decorate a set of elements as a whole.
I conlude DisplayGroup  would not fit this scenario, since you need to "decorate somehere between the elements rather than it's concatenated output".


Well, of course I need JS to do the toggling. Deciding where to put the toggle-element could be off-loaded to Javascript of course. Good suggestion.
Jurian Sluiman

Re: [Zend_Form] howto: multiCheckbox with collapsible lower elements‏

Reply Threaded More More options
Print post
Permalink
Some javascript/style in this post has been disabled (why?)
I thought about the list items at http://datatables.net when I read your mail.


They have the idea: we have a list with x items. They are with too much so we show only y items. The others are hidden. Click on the last entry saying "show more" and this entry removes and the other z items are displayed.


No toggling whatsoever, because youonly click "show more" when you're interested (you want to read the items). Perhaps toggling is more difficult, then a display group or a second element might help indeed.


Regards, Jurian
--
Jurian Sluiman
Soflomo.com


Op Saturday 24 October 2009 19:46:04 schreef Exception e:
> Jurian Sluiman wrote:
> > With the display-group you could render things like fieldset (but also
> > any other element).
> >
> > I think what you want is dynamic behaviour which shouldn't be done with
> > html/css. This is behaviour meant for javascript. With the jQuery view
> > helper
> > it's really easy to accomplish.
>
> Display-group lends itself for easy wrapping. But a subform would do the
> same trick isn't it? Okay, that's less efficient of course.
> As I understand now, the purpose of a DisplayGroup is make it easy to
> decorate a set of elements as a whole.
> I conlude DisplayGroup would not fit this scenario, since you need to
> "decorate somehere between the elements rather than it's concatenated
> output".
>
>
> Well, of course I need JS to do the toggling. Deciding where to put the
> toggle-element could be off-loaded to Javascript of course. Good
> suggestion.



signature.asc (204 bytes) Download Attachment
Exception e

Re: [Zend_Form] howto: multiCheckbox with collapsible lower elements‏

Reply Threaded More More options
Print post
Permalink
Jurian Sluiman wrote:
I thought about the list items at http://datatables.net when I read your mail.

They have the idea: we have a list with x items. They are with too much so we
show only y items. The others are hidden. Click on the last entry saying "show
more" and this entry removes and the other z items are displayed.

No toggling whatsoever, because youonly  click "show more" when you're
interested (you want to read the items). Perhaps toggling is more difficult,
then a display group or a second element might help indeed.
 
They use a complete grid I see.
Yeah, toggling makes that I need JS. If I only had the option "show more" than I could handle the show with css' :active alone.

I am not afraid of JS, so yeah, I could do everything there.