PHPackages                             nickelit/html - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. nickelit/html

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

nickelit/html
=============

HTML Input helpers

v1.2.6(10y ago)038proprietaryPHP

Since Mar 28Pushed 9y ago1 watchersCompare

[ Source](https://github.com/enimiste/html)[ Packagist](https://packagist.org/packages/nickelit/html)[ RSS](/packages/nickelit-html/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (8)Used By (0)

Installation
------------

[](#installation)

- jquery-2.2.2.min.js
- underscore-min.js
- Add script(); ?&gt; to the js section in your template or view

Use case :
----------

[](#use-case-)

### Statiquement :

[](#statiquement-)

```
use Com\NickelIt\Html\Select\Option\ChildOption;
use Com\NickelIt\Html\Select\Option\ParentOption;
use Com\NickelIt\Html\Select\SelectBuilder;

/*
* SelectBuilder::thisParent(string $select_input_id, array $options)->withChild(string $sub_select_input_id, array $sub_options)...
* ParentOption(string $id, string $title)
* ChildOption(string $direct_parent_id, string $id, string $title)
*
* HTML Helper :
* ->render( string $select_box_name, string $id, array $select_html_attribut = [] );
*
* In Your php script or your controller you access the selected values by "select_box_name". The returned value is the $id of the option.
*/
$selectBuilder = SelectBuilder::thisParent( 'ville_production',
	[
		new ParentOption( '10', 'Rabat' ),
		new ParentOption( '20', 'Salé' ),
		new ParentOption( '30', 'Casa' ),
	]
)->withChild( 'site_production',
	[
		new ChildOption( '10', '10', 'Site de Agdal' ),
		new ChildOption( '10', '20', 'Site de Rabat ville' ),
		new ChildOption( '20', '30', 'Site de Salé Tabrikt' ),
		new ChildOption( '30', '40', 'Site de Casa Port' ),
		new ChildOption( '30', '50', 'Site de Casa Sidi Momen' ),
		new ChildOption( '30', '60', 'Site de Casa Sidi Maarouf' ),
	]
)->withChild( 'projet_production',
	[
		new ChildOption( '10', '10', 'Projet Orange Rabat Agdal' ),
		new ChildOption( '20', '20', 'Projet Orange Rabat ville' ),
		new ChildOption( '20', '30', 'Projet Axa Assurance Rabat ville' ),
		new ChildOption( '30', '40', 'Projet Axa Assurance Salé Tabrikt' ),
		new ChildOption( '30', '50', 'Projet Axa Assurance Salé Tabrikt' ),
	]
)->withChild( 'equipe_production',
	[
		new ChildOption( '10', '10', 'Equipe A' ),
		new ChildOption( '10', '10', 'Equipe B' ),
		new ChildOption( '20', '10', 'Equipe C' ),
		new ChildOption( '30', '10', 'Equipe D' ),
	]
)->end();

?>

		Ville de production
