First release of Yii Form package was done. It provides a set of widgets to help with dynamic server-side generation of HTML forms. The following widgets are available out of the box:
- input fields:
Checkbox
,CheckboxList
,Date
,DateTimeLocal
,Email
,File
,Hidden
,Image
,Number
,Password
,RadioList
,Range
,Select
,Telephone
,Text
,Textarea
,Time
,Url
; - buttons:
Button
,ResetButton
,SubmitButton
; - group widgets:
ButtonGroup
,Fieldset
. - other:
ErrorSummary
.
General usage:
use Yiisoft\Form\PureField\Field;
echo Field::text('firstName', theme: 'horizontal')
->label('First Name')
->autofocus();
echo Field::text('lastName', theme: 'horizontal')
->label('Last Name');
echo Field::select('sex')
->label('Sex')
->optionsData(['m' => 'Male', 'f' => 'Female'])
->prompt('—');
echo Field::number('age')
->label('Age')
->hint('Please enter your age.');
echo Field::submitButton('Submit')
->buttonClass('primary');