yii2-filemanager icon indicating copy to clipboard operation
yii2-filemanager copied to clipboard

Having trouble getting this to work with jquery repeatable fields

Open con322 opened this issue 9 years ago • 0 comments

When used within the repeatable fields the input/browse button is displayed and I can see the modal/iframe in my source.

On browse button click it just goes to home/base url.

I have the below code within my form:

<?php echo $form->field($model, 'publisher[{{row-count-placeholder}}][logo]')->widget(FileInput::className(), [
                            'id' => uniqid(),
                            'buttonTag' => 'button',
                            'buttonName' => 'Browse',
                            'buttonOptions' => ['class' => 'btn btn-default'],
                            'options' => ['class' => 'form-control'],
                            // Widget template
                            'template' => '<div class="input-group">{input}<span class="input-group-btn">{button}</span></div>',
                            // Optional, if set, only this image can be selected by user
                            'thumb' => 'original',
                            // Optional, if set, in container will be inserted selected image
                            'imageContainer' => '.img',
                            // Default to FileInput::DATA_URL. This data will be inserted in input field
                            'pasteData' => FileInput::DATA_URL,
                            // JavaScript function, which will be called before insert file data to input.
                            // Argument data contains file data.
                            // data example: [alt: "Ведьма с кошкой", description: "123", url: "/uploads/2014/12/vedma-100x100.jpeg", id: "45"]
                            'callbackBeforeInsert' => 'function(e, data) {
                                console.log( data );
                            }',
                        ]); ?>

Which outputs the follow html

<div class="form-group field-reviews-publisher-1-logo">
<label class="control-label" for="reviews-publisher-1-logo">Publisher</label>
<div class="input-group"><input type="text" id="reviews-publisher-1-logo" class="form-control"    name="Reviews[publisher][1][logo]"><span class="input-group-btn"><button id="reviews-publisher-1-logo-btn" class="btn btn-default" role="filemanager-launch">Browse</button></span></div>
 <div role="filemanager-modal" class="modal" tabindex="-1" data-frame-id="reviews-publisher-1-logo-frame" data-frame-src="/backend/index.php?r=filemanager%2Ffile%2Ffilemanager" data-btn-id="reviews-publisher-1-logo-btn" data-input-id="reviews-publisher-1-logo" data-image-container=".img" data-paste-data="url" data-thumb="original">
<div class="modal-dialog">
    <div class="modal-content">
            <div class="modal-body"></div>
        </div>
    </div>
</div>

<div class="help-block"></div>
</div>

con322 avatar Jun 14 '15 20:06 con322