Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/proloser/cakephp-splitform-helper

Splits grouped form inputs into separate groups or individual inputs
https://github.com/proloser/cakephp-splitform-helper

Last synced: 9 days ago
JSON representation

Splits grouped form inputs into separate groups or individual inputs

Awesome Lists containing this project

README

        

# 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'));