dev-master
9999999-devCollection of form fields
MIT
The Requires
extension yii2 form fields
0.0.1
0.0.1.0Collection of form fields
MIT
The Requires
extension yii2 form fields
Wallogit.com
2017 © Pedro Peláez
Collection of form fields
Collection of form fields, (*1)
The preferred way to install this extension is through composer., (*2)
Either run, (*3)
php composer.phar require --prefer-dist fgh151/yii2-form-fields "*"
or add, (*4)
"fgh151/yii2-form-fields": "*"
to the require section of your composer.json file., (*5)
Once the extension is installed, simply use it in your code by :, (*6)
$form = ActiveForm::begin();
echo \fgh151\fields\InputWidget::widget([
'model' => $model,
'attribute' => 'attributeName',
'type' => \fgh151\fields\FieldTypes::getByName('text'), //default text
]);
ActiveForm::end();
Input without model, (*7)
echo \fgh151\fields\InputWidget::widget([
'model' => new \yii\base\DynamicModel(['attributeName']),
'attribute' => 'attributeName',
]);
Input with custom label and value, (*8)
echo \fgh151\fields\InputWidget::widget([
'model' => new \yii\base\DynamicModel(['attributeName']),
'attribute' => 'attributeName',
'options' => [
'label' => 'Custom label',
'value' => 'Some value',
]
]);
Available field types: * text - input type text * email - input type email * number - input type number * textarea - text area * binaryCheckbox - single check box (for example agree field) * checkboxList - list check boxes with same name * checkboxListOther - list check boxes with same name and input text field * binaryRadio - single radio button * radioList - list of radio buttons * radioListOther - list of radio boxes with other text field * file - file input field, (*9)
BinaryCheckbox - is binary field, for example agree field, (*10)
echo \fgh151\fields\InputWidget::widget([
'model' => new \yii\base\DynamicModel(['FirstName']),
'attribute' => 'FirstName',
'type' => 6, //You can specify direct see \fgh151\fields\FieldTypes
'options' => [
'variants' => [
['label' => 'var1', 'value' => 'var1'],
['label' => 'var2', 'value' => 'var2'],
['label' => 'var3', 'value' => 'var3'],
]
]
]);
for 'other' label you can pass custom text:, (*11)
echo \fgh151\fields\InputWidget::widget([
'model' => new \yii\base\DynamicModel(['FirstName']),
'attribute' => 'FirstName',
'type' => 6, //You can specify direct see \fgh151\fields\FieldTypes
'options' => [
'variants' => [
['label' => 'var1', 'value' => 'var1'],
['label' => 'var2', 'value' => 'var2'],
['label' => 'var3', 'value' => 'var3'],
]
],
'otherText' => 'Другое'
]);
Collection of form fields
MIT
extension yii2 form fields
Collection of form fields
MIT
extension yii2 form fields