PHP code example of vojtech-dobes / nette-forms-inputlist

1. Go to this page and download the library: Download vojtech-dobes/nette-forms-inputlist library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

vojtech-dobes / nette-forms-inputlist example snippets


$configurator->onCompile[] = function ($configurator, $compiler) {
	$compiler->addExtension('inputlist', new VojtechDobes\NetteForms\InputListExtension);
};

$form->addMultiRadio('sex', 'Sex:', array(
	'male' => 'Male',
	'female' => 'Female',
));

$checkboxlist = $form->addMultiCheckbox('topics', 'I like:', array(
	'l' => 'lifestyle',
	'm' => 'military',
	'c' => 'computers',
	'f' => 'flowers',
));

$checkboxlist->setDefaultValue(array('l', 'm')); // lifestyle, military

$checkboxlist->getValue() === array(0 => 'l', 1 => 'm')

$radiolist->omitLastSeparator();
html
{form formName}
	{inputlist sex as $key => $label}
		{input} {label /} {sep}<br>{/sep}
	{/inputlist}
{/form}
html
{form formName}
	{inputlist sex as $key => $label}
		{input class => 'input-radio'} {label}{$label}{/label}<br>
	{/inputlist}
{/form}
html
{form formName}
	<ul n:inner-inputlist="sex as $key => $label">
		<li>{input} {label /}</li>
	</ul>
{/form}