Download the PHP package vojtech-dobes/nette-forms-inputlist without Composer
On this page you can find all versions of the php package vojtech-dobes/nette-forms-inputlist. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download vojtech-dobes/nette-forms-inputlist
More information about vojtech-dobes/nette-forms-inputlist
Files in vojtech-dobes/nette-forms-inputlist
Package nette-forms-inputlist
Short Description Alternative RadioList & CheckboxList for Nette Framework
License New BSD
Homepage http://github.com/vojtech-dobes/nette-forms-inputlist
Informations about the package nette-forms-inputlist
For Nette Framework
Alternative RadioList & CheckboxList for Nette Framework
License
New BSD
Dependencies
Nette 2.0.0
Installation
- Get the source code from Github or via Composer (
vojtech-dobes/nette-forms-inputlist
). - Register
VojtechDobes\NetteForms\InputListExtension
as extension for$configurator
.
Usage
RadioList
Method's name was chosen to not interfere with native
addRadiolist
.
CheckboxList
Defaults
Returned values
Rendering
Automatic
Both RadioList
and CheckboxList
provide standard mechanism like getControlPrototype
etc. You can also force omitting of last separator:
Manual
There is special new macro for Latte templates: {inputlist}
. It behaves exactly like {foreach}
, but it's specifically design to work with *List
form elements.
Macros {input}
and {label}
behave the same way as always, but when used without element identificator, they will render proper elements for iteration specific item. If you use it with identificator, it will render appropriate element from form.
You can add HTML attributes to them as usually.
Attribute version of {inputlist}
is also possible:
Validation
Here supported rules are listed:
CheckboxList
Form::FILLED | At least one box must be checked. |
---|---|
Form::LENGTH | Exact amount of boxes that must be checked. |
Form::MIN_LENGTH | Minimum amount of boxes that must be checked. |
Form::MAX_LENGTH | Maximum amount of boxes that must be checked. |
Form::RANGE | Minimum and maximum amount of boxes that must be checked. |
Form::REGEXP | Checks if selected checkbox values match regular expression. |
RadioList
Form::FILLED | One button must be selected. |
---|---|
Form::REGEXP | Checks if selected radio value matches regular expression. |
All rules are also supported on client-side.