This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

wmsomnium9780
wmsomnium9780

Please help me.

When select records in list index controller and press "Delete selected" button gives popup message "Invalid input data"

_list_toolbar.htm

<div data-control="toolbar">
    <a
        href="<?= Backend::url('insamo/aggregator/delivery/create') ?>"
        class="btn btn-primary oc-icon-plus">
        <?= e(trans('insamo.aggregator::lang.delivery.create_label')) ?>
    </a>

    <button
        class="btn btn-default oc-icon-trash-o"
        disabled="disabled"
        onclick="$(this).data('request-data', {
            checked: $('.control-list').listWidget('getChecked')
        })"
        data-request="onDelete"
        data-request-confirm="<?= e(trans('rainlab.user::lang.users.delete_selected_confirm')) ?>"
        data-trigger-action="enable"
        data-trigger=".control-list input[type=checkbox]"
        data-trigger-condition="checked"
        data-request-success="$(this).prop('disabled', true)"
        data-stripe-load-indicator>
        <?= e(trans('backend::lang.list.delete_selected')) ?>
    </button>
</div>

Last updated

uXMs
uXMs

this seems ok. can you share index_onDelete method?

wmsomnium9780
wmsomnium9780

uXMs said:

this seems ok. can you share index_onDelete method?

there \modules\cms\controllers\Index.php?

public function onDelete()
    {
        $this->validateRequestTheme();

        $type = Request::input('templateType');

        $this->loadTemplate($type, trim(Request::input('templatePath')))->delete();

        /*
         * Extensibility
         */
        Event::fire('cms.template.delete', [$this, $type]);
        $this->fireEvent('template.delete', [$type]);
    }

or \modules\cms\widgets\MediaManager.php

public function onDelete()
    {
        $paths = Input::get('paths');

        if (!is_array($paths)) {
            throw new ApplicationException('Invalid input data');
        }

        $library = MediaLibrary::instance();

        $filesToDelete = [];
        foreach ($paths as $pathInfo) {
            if (!isset($pathInfo['path']) || !isset($pathInfo['type'])) {
                throw new ApplicationException('Invalid input data');
            }

            if ($pathInfo['type'] == 'file') {
                $filesToDelete[] = $pathInfo['path'];
            }
            else if ($pathInfo['type'] == 'folder') {
                $library->deleteFolder($pathInfo['path']);
            }
        }

        if (count($filesToDelete) > 0)
            $library->deleteFiles($filesToDelete);

        $library->resetCache();
        $this->prepareVars();

        return [
            '#'.$this->getId('item-list') => $this->makePartial('item-list')
        ];
    }

Last updated

1-3 of 3

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.