Form builder library for HTML forms.
Install via composer:
composer require minphp/form
TODO
Form Builder Library
When using Form::select and including options that are set as <optgroup>
tags, the optgroup is only closed when the end of the options have been reached or a new optgroup has been started. Thus, there is no way to set an <option>
outside of an <optgroup>
if an <optgroup>
has already been created earlier in the option list.
There should be an option to close an optgroup just like there is an option to create an optgroup, i.e., specifying the value "close_optgroup" to close any open optgroup similar to how the value optgroup closes and begins a new optgroup.
For example, setting the following options:
$options = array(
array('name' => "Group 1", 'value' => "optgroup"),
array('name' => "Item 1", 'value' => "1"),
array('name' => "Item 2", 'value' => "2"),
array('name' => "", 'value' => "close_optgroup"),
array('name' => "Item 3", 'value' => "3"),
array('name' => "Group 2", 'value' => "optgroup"),
array('name' => "Item 4", 'value' => "4"),
array('name' => "Group 3", 'value' => "optgroup"),
array('name' => "Item 5", 'value' => "5"),
);
...should render the following HTML select options where "Item 3" is outside of an optgroup:
<select name="x">
<optgroup label="Group 1">
<option value="1">Item 1</option>
<option value="2">Item 2</option>
</optgroup>
<option value="3">Item 3</option>
<optgroup label="Group 2">
<option value="4">Item 4</option>
</optgroup>
<optgroup label="Group 3">
<option value="5">Item 5</option>
</optgroup>
</select>
When using a Select/MultiSelect form field, the option values are doubly-html-encoded, which results in inaccurate values when any characters are converted, like ">" being converted to ">". This appears to be caused by the use of Html::safe()
via Html::_()
which is set when the select option value is set in Form::selectOptions()
(line 662) and again when used via Html::buildAttributes()
shortly thereafter (line 670).
The solution looks to be in changing line 662:
$attr['value'] = $this->_($value, true);
to
$attr['value'] = $value;
There's no public methods for HTML 5 input field types such as number
, etc -
https://www.w3.org/TR/html5/forms.html#attr-input-type
The super-method fieldInput
is private, so there's absolutely no way to create such fields.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.