Comments (14)
I'm working on it now. At the moment works well with MasKmoney, Fileinput, Touchspin and Datepicker.
from yii2-dynamicform.
first of thanks for your response, waiting for the updates.. hoping for a fast release :D
from yii2-dynamicform.
Amazing you have already updated with select2 widget. Waiting for typeahead :D
from yii2-dynamicform.
Hello,
For some reason kartik select2 doesn't work in my configuration.
I have this:
$countrylist = ArrayHelper::map(Countries::find()->orderBy('country_id')->all(), 'country_id', 'country_name');
<?php DynamicFormWidget::begin([
'dynamicItems' => '#form-qualifications',
'dynamicItem' => '.form-qualifications-item',
'model' => $modelsQualifications[0],
'formId' => 'registration-step-1',
'formFields' => [
'employee_employment_position',
'employee_employment_start_date',
'employee_employment_end_date',
'employee_employment_reason',
'employee_employment_organisation',
'employee_employment_town',
'employee_employment_country',
],
'options' => [
'limit' => 4, // the maximum times, an element can be cloned (default 999)
]
]); ?>
<?php
echo $form->field($modelQualifications, '[]employee_employment_country')->widget(Select2::classname(), [
'data' => $countrylist,
'options' => ['placeholder' => 'Select country ...'],
'pluginOptions' => [
'allowClear' => true
],
]);
?>
I get the following when I click on [+](see Employee Qualification Country)
Thank you!!
from yii2-dynamicform.
Index of the attribute can not be empty.
Change:
'[]employee_employment_country'
To
"[{$index}]employee_employment_country"
from yii2-dynamicform.
Hello,
Changed that to
<?php
echo $form->field($modelQualifications, '['.$i.']employee_employment_country')->widget(Select2::classname(), [
'data' => $countrylist,
'options' => ['placeholder' => 'Select country ...'],
'pluginOptions' => [
'allowClear' => true
],
]);
?>
Whole code:
<?php
use yii\helpers\ArrayHelper;
use yii\helpers\Html;
use yii\helpers\URL;
use frontend\models\TitlesList;
use frontend\models\Yesorno;
use frontend\models\Countries;
use frontend\models\EmployeeEmployment;
use wbraganca\dynamicform\DynamicFormWidget;
use yii\bootstrap\Modal;
use kartik\widgets\ActiveForm;
use kartik\widgets\DatePicker;
use kartik\widgets\Select2;
?>
<?php
$form = ActiveForm::begin(['id'=>'registration-step-1','options'=>['class'=>'form-block']]);
?>
<?php
$titleslist = ArrayHelper::map(TitlesList::find()->orderBy('title_order')->all(), 'title_id', 'title_name');
$yesornolist = ArrayHelper::map(Yesorno::find()->orderBy('yesorno_order')->all(), 'yesorno_id', 'yesorno_name');
$countrylist = ArrayHelper::map(Countries::find()->orderBy('country_id')->all(), 'country_id', 'country_name');
?>
<?= Html::activeDropDownList($modelEmployee, 'employee_title', $titleslist, array('class'=>'form-control','prompt'=>'Please Select Title')) ?>
<?= $form -> field ($modelEmployee,'employee_firstname') ?>
<?= $form -> field ($modelEmployee,'employee_lastname') ?>
<?= $form -> field ($modelEmployee,'employee_workpermit')->radiolist($yesornolist,['itemOptions' => ['class' =>'radio-inline']]) ?>
<p>Contact Information</p>
<?= $form -> field ($modelEmployee,'employee_email') ?>
<?= $form -> field ($modelEmployee,'employee_phone') ?>
<?= $form -> field ($modelEmployee,'employee_mobile') ?>
<?= $form -> field ($modelEmployee,'employee_address') ?>
<?= $form -> field ($modelEmployee,'employee_town') ?>
<?= $form -> field ($modelEmployee,'employee_country') ?>
<?= $form -> field ($modelEmployee,'employee_postcode') ?>
<p>Education</p>
<?
//echo $form -> field ($modelEmployee,'employeeQualifications')
?>
<?php DynamicFormWidget::begin([
'dynamicItems' => '#form-qualifications',
'dynamicItem' => '.form-qualifications-item',
'model' => $modelsQualifications[0],
'formId' => 'registration-step-1',
'formFields' => [
'employee_employment_position',
'employee_employment_start_date',
'employee_employment_end_date',
'employee_employment_reason',
'employee_employment_organisation',
'employee_employment_town',
'employee_employment_country',
],
'options' => [
'limit' => 5,
]
]); ?>
<div id="form-qualifications">
<?php foreach ($modelsQualifications as $i => $modelQualifications): ?>
<div class="form-qualifications-item panel panel-default">
<div class="panel-heading">
<h3 class="panel-title pull-left">Qualifications</h3>
<div class="pull-right">
<button type="button" class="clone btn btn-success btn-xs"><i class="glyphicon glyphicon-plus"></i></button>
<button type="button" class="delete btn btn-danger btn-xs"><i class="glyphicon glyphicon-minus"></i></button>
</div>
<div class="clearfix"></div>
</div>
<div class="panel-body">
<?php
// necessary for update action.
if (!$modelQualifications->isNewRecord) {
echo Html::activeHiddenInput($modelQualifications, "[{$i}]id");
}
?>
<?= $form->field($modelQualifications, "[{$i}]employee_employment_position")->textInput(['maxlength' => 64]) ?>
<div class="row">
<div class="col-sm-6">
<?php
echo $form->field($modelQualifications, "[{$i}]employee_employment_start_date")->widget(DatePicker::classname(), [
'options' => ['placeholder' => 'Please enter employment start date'],
'pluginOptions' => [
'autoclose'=>true,
'format' => 'dd/mm/yyyy'
]
]);
?>
</div>
<div class="col-sm-6">
<? //$form->field($modelQualifications, "[{$i}]employee_employment_end_date")->textInput(['maxlength' => 128]) ?>
<?php
echo $form->field($modelQualifications, "[{$i}]employee_employment_end_date")->widget(DatePicker::classname(), [
'options' => ['placeholder' => 'Please enter employment end date'],
'pluginOptions' => [
'autoclose'=>true,
'format' => 'dd/mm/yyyy'
]
]);
?>
</div>
</div><!-- .row -->
<div class="row">
<div class="col-sm-4">
<?= $form->field($modelQualifications, "[{$i}]employee_employment_reason")->textInput(['maxlength' => 64]) ?>
</div>
<div class="col-sm-4">
<?= $form->field($modelQualifications, "[{$i}]employee_employment_organisation")->textInput(['maxlength' => 32]) ?>
</div>
<div class="col-sm-4">
<?= $form->field($modelQualifications, "[{$i}]employee_employment_town")->textInput(['maxlength' => 15]) ?>
</div>
<div class="col-sm-4">
<?php
echo $form->field($modelQualifications, "[{$i}]employee_employment_country")->widget(Select2::classname(), [
'data' => $countrylist,
'options' => ['placeholder' => 'Select country ...'],
'pluginOptions' => [
'allowClear' => true
],
]);
?>
</div>
</div><!-- .row -->
</div>
</div>
<?php endforeach; ?>
</div>
<?php DynamicFormWidget::end(); ?>
<p>Employment in the last two years</p>
<p>Languages</p>
<p>Additional information</p>
<div class="form-group">
<?= Html::submitButton('Submit', ['class' => 'btn btn-primary']) ?>
</div>
<?php
ActiveForm::end();
?>
still doesn't work.
from yii2-dynamicform.
Ensure that you are using the latest version of "Select2" and "yii2-dynamicform".
from yii2-dynamicform.
i update latest version but still not working
from yii2-dynamicform.
hi,
is this extension now working for typehead?
from yii2-dynamicform.
Hello,
thanks for your nice yii2-dynamicform.
Unfortunately even for me typeahead is not working in a dynamicform field.
Do you have any plan about it?
Thanks in advance
from yii2-dynamicform.
@dariopalmisano check this file:
https://github.com/vilkh3m/yii2-dynamicform/blob/master/src/assets/yii2-dynamic-form.js
and compare with your code lines from 457 to 465 this fix my problem
and i need use symfony/css-selector and symfony/dom-crawler in version 2.6.6, this don work on version 2.7.*
but im unable to use this via composer :( i just copy code from github
from yii2-dynamicform.
Thanks vilkh3m for your quick response.
Unfortunately I had already applied that patch to make yii2-widget-select2 work in a yii2-dynamicform field!
Regards
from yii2-dynamicform.
Dear your problem solved or not?
I faced same problem.
Did you find typehead dynamic form solution?
from yii2-dynamicform.
Dear your problem solved or not?
I faced same problem.
Did you find typehead dynamic form solution?
did you try this: aeff3d0 ?
from yii2-dynamicform.
Related Issues (20)
- autocomplete and dynamic form
- Updating yii2 Select2 ID in yii2-dynamicform
- hide icon button of class="delete-item" if min 1 or more than 1 HOT 1
- explain $searchModel = new CustomerQuery() this line code for Nested dynamic forms Demo 1
- How to create controller in demo 1 (Nested Dynamic Form) HOT 2
- How to create controller in demo 1 (Nested Dynamic Form)
- Upload widget does not work - Dynamic form Yii2 starter kit HOT 2
- Ajax validation stop working after deleting any dynamic item HOT 1
- TreeViewInput widget from the karti-v/yii2-tree-manager does not work
- dropDownList and checkbox not reset value beforeInsert
- Inconsistency in dom ids
- Speed issues with Dynamic form
- Dynamic form behavior not working properly with javascript alert in yii2
- Uncaught TypeError: yiiActiveFormData is undefined
- dom-crawler bug with PHP 8.1: please use a newer version HOT 7
- Cant save in data in database using dynamic form in one model
- Cannot read properties of undefined (reading 'settings') HOT 1
- Select2 problem on nested
- Clone issue in update form HOT 1
- How can I handle $i model attribute
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from yii2-dynamicform.