Home > CakePHP-SplitForm-Helper

CakePHP-SplitForm-Helper

CakePHP-SplitForm-Helper is a project mainly written in PHP, it's free.

Splits grouped form inputs into separate groups or individual inputs

CakePHP Split Form Helper

This helper allows you to break apart multi-selects, checkbox groups, and radio groups into multiple places on the page.

If you've ever wanted something like:

[ ] Choice A

This choice would give you lots of options such as:

  • Long hair
  • Youthful vigor
  • STDs

[ ] Choice B

This is the wrong choice. People who select it are:

  • Morons
  • Short
  • Have ED

This allows you to add content in between the form inputs. You can also separate inputs into small groups.

Fruits:

  • ( ) Apple
  • ( ) Orange
  • ( ) Pair

Vegatables:

  • ( ) Cabbage
  • ( ) Carrots
  • ( ) Potatoes

How to use

  1. Clone/Download to plugins/split_form
  2. Add the helper to your controller var $helpers = array('SplitForm.SplitForm');
  3. Set the view variable in the controller $this->set('categories', $this->Post->Category->find('list'));
  4. Call the method:

For one specific value

echo $this->SplitForm->input('Category', 7);

For multiple inputs

echo $this->SplitForm->input('Category', array(3, 2, 6, 7));

Advanced options

echo $this->SplitForm->input('Category', array(
    3 => 'Category 3', 
    2 => array('label' => 'Category 2', 'class' => 'special')
), array('legend' => 'Category group 1'));