Coder Social home page Coder Social logo

Comments (14)

wbraganca avatar wbraganca commented on July 30, 2024

I'm working on it now. At the moment works well with MasKmoney, Fileinput, Touchspin and Datepicker.

from yii2-dynamicform.

skeeran avatar skeeran commented on July 30, 2024

first of thanks for your response, waiting for the updates.. hoping for a fast release :D

from yii2-dynamicform.

skeeran avatar skeeran commented on July 30, 2024

Amazing you have already updated with select2 widget. Waiting for typeahead :D

from yii2-dynamicform.

loter avatar loter commented on July 30, 2024

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)

err1

Thank you!!

from yii2-dynamicform.

wbraganca avatar wbraganca commented on July 30, 2024

Index of the attribute can not be empty.

Change:

'[]employee_employment_country'

To

"[{$index}]employee_employment_country"

from yii2-dynamicform.

loter avatar loter commented on July 30, 2024

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.

wbraganca avatar wbraganca commented on July 30, 2024

Ensure that you are using the latest version of "Select2" and "yii2-dynamicform".

from yii2-dynamicform.

charithAmila avatar charithAmila commented on July 30, 2024

i update latest version but still not working

from yii2-dynamicform.

vaibhavk01 avatar vaibhavk01 commented on July 30, 2024

hi,
is this extension now working for typehead?

from yii2-dynamicform.

dariopalmisano avatar dariopalmisano commented on July 30, 2024

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.

vilkh3m avatar vilkh3m commented on July 30, 2024

@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.

dariopalmisano avatar dariopalmisano commented on July 30, 2024

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.

imdad6053 avatar imdad6053 commented on July 30, 2024

Dear your problem solved or not?
I faced same problem.
Did you find typehead dynamic form solution?

from yii2-dynamicform.

vilkh3m avatar vilkh3m commented on July 30, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.