Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/landrisek/nette-range
Range extension for nette forms
https://github.com/landrisek/nette-range
Last synced: 12 days ago
JSON representation
Range extension for nette forms
- Host: GitHub
- URL: https://github.com/landrisek/nette-range
- Owner: landrisek
- License: mit
- Created: 2016-10-03T10:32:12.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-11-02T10:46:22.000Z (about 6 years ago)
- Last Synced: 2024-10-17T22:25:49.746Z (about 1 month ago)
- Language: JavaScript
- Size: 240 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Range
==================
Range extension for nette formsDemo
----
- Composer package: https://packagist.org/packages/landrisek/nette-rangeInstallation
------------
1. Install [composer](https://getcomposer.org/download/) if you don't have it yet
2. run `composer require landrisek/nette-range:1.*`
3. Copy files from nette-range/assets to your www/assets and include them into your template or follow Optional settingsRequired settings
-----------------
Edit your config.neonextensions:
range: Range\RangeExtensionAdd to template:
Add in MyForm::attached:
$this->addRange('myRangeId', 'My range label')
->setDefaultValue('min'=>$minimalValue,'max'=>$maximalValue,'from'=>$fromValue,'to'=>$toValue);Add in MyForm::render:
$this->templates->ranges = ['myRangeId','myOtherRangeId'];In formSucced method you will get array:
public function formSucceed($form) {
$values = $form->getValues();
$from = $values['myRangeId']['from'];
$to = $values['myRangeId']['to'];
}Optional settings
-----------------Edit your config.neon:
services:
- Range\IRangeFactoryAdd to your form / component:
/** @var IRangeFactory */
private $rangeFactory;
public function __construct(Range\IRangeFactory $rangeFactory) {
$this->rangeFactory = $rangeFactory;
}
protected function createComponentRange() {
return $this->rangeFactory->create();
}
Add to template of your form / component:{control range:head}
{control $myForm}
{control range:footer}