CSV Import javscript errors

Bauer

Well-Known Member
I think I may have posted this before, but... When I click the import option from a list, the CSV Import form is loaded with javascript errors. (See attachment)

It seems to work ok - but it seems strange that the 'No file chosen' message is shown initially. I don't think it used to be like that. And when I click to select a file the text turns red and the select element is bordered in red. (If that might be any clue to why all the javascript errors.)

Running Joomla 3.5.1 with php 7 and recent github update from a day or 2 ago.

Also, I've always been wondering why that CSV Upload form is its own page. Can it be put in a modal popup - like the CSV Export is?
 

Attachments

  • csvimport_jsErrors.png
    csvimport_jsErrors.png
    62.8 KB · Views: 94
I find myself responding to my own posts a lot lately :rolleyes: - but I have to pass this on.

I've spent the last few hours trying to solve the issues mentioned above.
And BTW, it turns out the javascript errors aren't there if I use the default bootstrap template. But this particular list is using a template I customized to allow a true "spreadsheet-like" inline editing, yet I still have no idea what I might have changed to make the javascript behave any differently; everything else still works fine.

A Google search brought me to this 5-year-old thread at fabrikar.com...
How to open a form in a pop up | Fabrik

After a little experimenting, I now have the CSV Import form coming up in a popup - and with no javascript errors :) - by using the NoNumber (I mean 'RegularLabs', excuse me, Peter) 'Modals' plugin.

And it even dims the list with an overlay and re-paints and re-centers itself if the browser window is resized! What more could I ask for? :cool: (See attachment)

Anyhow... That was done with a one-line change in the default_buttons.php file of the Fabrik list template. If anyone ever needs to go this route, and has RegularLabs' Modal plugin installed, just locate this line (#87?)...
PHP:
$displayData->links[] = '<a href="' . $this->csvImportLink . '" class="csvImportButton">' . FabrikHelperHTML::icon('icon-download', FText::_('COM_FABRIK_IMPORT_FROM_CSV'))  . '</a>';
and replace it with...
PHP:
$displayData->links[] = '{modal href='.$this->csvImportLink.'}'. FabrikHelperHTML::icon('icon-download', FText::_('COM_FABRIK_IMPORT_FROM_CSV')) .'{/modal}';
...where 'modal' is one of the 'Classnames' configured in the 'Existing Links' section of the Regular Labs Modal plugin configuration form.

What a way to start my holiday weekend. Phil is one happy camper. :D
 

Attachments

  • csvimport_Fixed.png
    csvimport_Fixed.png
    99.2 KB · Views: 88
Last edited:
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top