Jump to content

File Input Fields: drag'n'drop gone when cloned


dragan
 Share

Recommended Posts

I have cloned (duplicated) a few file input fields today, but found the following odd behaviour:

- Drag'n'drop is no longer possible.

- Trash icon doesn't display in Mac/Safari + Mac/Chrome.

- I can't delete any uploaded files anymore.

addtl. infos:

Filetypes are usual stuff / allowed file-types (PDF mostly) etc.

PW 2.3.2 dev

Files are visible in the backend and in the DB.

Tried on Mac Safari + Win Google Chrome (in the latter, the trash icon is fine)

Due to a large number of input fields, we've resized the input field width to 50 or 25%, but changing them back to 100% didn't do anything.

Link to comment
Share on other sites

 

Looking in the page edit HTML source, I noticed this:

How it looks in the duplicated input fields where drag'n'drop doesn't work:

<span class="AjaxUploadDropHere description"><span class="ui-icon ui-icon-arrowreturnthick-1-s ui-priority-secondary"></span>  drag and drop files in here</span>

How it looks in those that do work normally:

<span class="AjaxUploadDropHere description" style="display: inline;"><span class="ui-icon ui-icon-arrowreturnthick-1-s ui-priority-secondary"></span>  drag and drop files in here</span>

.InputfieldFileUpload .AjaxUploadDropHere {

    display: none;

}

In other words:

display: inline doesn't get rendered in the buggy fields. It overrides the display: none in wire/modules/Inputfield/InputfieldFile/InputfieldFile.css?v=100

This explains why the drag'n'drop area isn't visible. But what could possibly trigger this?

That still doesn't explain why uploaded files can't be deleted :(

The client already has backend access to update content, so unfortunately he already uploaded several files in several pages...

Anybody have a hint what went wrong when duplicating fields?
Link to comment
Share on other sites

Looking at it some longer, it turned out that there are either CSS bugs, or browser bugs.

Duplicating file input fields with Apple Safari or Firefox on Mac: Buggy. Trashcan icon is not visible.

Doing the same with Google Chrome on Mac: works fine.

Same with Google Chrome Win: works fine.

You'd think that Webkit browsers behave the same, but apparently not...

Link to comment
Share on other sites

That is some very strange stuff, since i would assume cloning a field is mostly a backend process. If you duplicate/clone file field on Safari or Firefox, does that cloned field work on Chrome? Or is it broken on every browser?

And clone with Chrome, works everywhere?

Are you using the default theme or some alternative?

Link to comment
Share on other sites

Strange indeed. Tell me about it.

The relevant CSS was in no way altered. We use the default admin theme, too.

Today I've spent 2 hours more on this.

Turns out that if you name an input field "file" with some sort of language code at the end like so: download_manual_fr, download_manual_en, download_manual_de

the system is somehow confused, for whatever reasons.

If you name a field foo_fr for type "text", everything works fine. I have these all over the place.

But as soon as you use such naming conventions for file-fields, it gets all sorts of confused.

Renaming such fields worked. e.g.

download_manual_fr -> download_manualfr

it works as advertised.

Perhaps someone who's an admin can cross-link it to the multilang forum?

Link to comment
Share on other sites

  • 2 weeks later...
But imho that still doesn't explain why drag-and-drop uploads stop working, and the trash can icon disappears.

I haven't been able to duplicate this one yet. You might want to see if updating your dev branch version helps at all? We're in a bit of a transition with the admin theme, so you might also see if using the new admin theme (copying /site-default/templates-admin/ to your /site/templates-admin/) makes any difference?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Similar Content

    • By David Karich
      ProcessWire InputfieldRepeaterMatrixDuplicate
      Thanks to the great ProModule "RepeaterMatrix" I have the possibility to create complex repeater items. With it I have created a quite powerful page builder. Many different content modules, with many more possible design options. The RepeaterMatrix module supports the cloning of items, but only within the same page. Now I often have the case that very design-intensive pages and items are created. If you want to use a content module on a different page (e.g. in the same design), you have to rebuild each item manually every time.
      This module extends the commercial ProModule "RepeaterMatrix" by the function to duplicate repeater items from one page to another page. The condition is that the target field is the same matrix field from which the item is duplicated. This module is currently understood as proof of concept. There are a few limitations that need to be considered. The intention of the module is that this functionality is integrated into the core of RepeaterMatrix and does not require an extra module.
      Check out the screencast
      What the module can do
      Duplicate multible repeater items from one page to another No matter how complex the item is Full support for file and image fields Multilingual support Support of Min and Max settings Live synchronization of clipboard between multiple browser tabs. Copy an item and simply switch the browser tab to the target page and you will immediately see the past button Support of multiple RepeaterMatrix fields on one page Configurable which roles and fields are excluded Configurable dialogs for copy and paste Duplicated items are automatically pasted to the end of the target field and set to hidden status so that changes are not directly published Automatic clipboard update when other items are picked Automatically removes old clipboard data if it is not pasted within 6 hours Delete clipboard itself by clicking the selected item again Benefit: unbelievably fast workflow and content replication What the module can't do
      Before an item can be duplicated in its current version, the source page must be saved. This means that if you make changes to an item and copy this, the old saved state will be duplicated Dynamic loading is currently not possible. Means no AJAX. When pasting, the target page is saved completely No support for nested repeater items. Currently only first level items can be duplicated. Means a repeater field in a repeater field cannot be duplicated. Workaround: simply duplicate the parent item Dynamic reloading and adding of repeater items cannot be registered. Several interfaces and events from the core are missing. The initialization occurs only once after the page load event Attention, please note!
      Nested repeaters cannot be supported technically. Therefore a check is made to prevent this. However, a nested repeater can only be detected if the field name ends for example with "_repeater1234". For example, if your MatrixRepeater field is named like this: "content_repeater" or "content_repeater123", this field is identified as nested and the module does not load. In version 2.0.1 the identification has been changed so that a field ending with the name repeater is only detected as nested if at least a two-digit number sequence follows. But to avoid this problem completely, make sure that your repeater matrix field does NOT end with the name "repeater".
      Changelog
       
      2.0.1
      Bug fix: Thanks to @ngrmm I could discover a bug which causes that the module cannot be loaded if the MatrixRepeater field ends with the name "repeater". The code was adjusted and information about the problem was provided 2.0.0
      Feature: Copy multiple items at once! The fundament for copying multiple items was created by @Autofahrn - THX! Feature: Optionally you can disable the copy and/or paste dialog Bug fix: A fix suggestion when additional and normal repeater fields are present was contributed by @joshua - THX! 1.0.4
      Bug fix: Various bug fixes and improvements in live synchronization Bug fix: Items are no longer inserted when the normal save button is clicked. Only when the past button is explicitly clicked Feature: Support of multiple repeater fields in one page Feature: Support of repeater Min/Max settings Feature: Configurable roles and fields Enhancement: Improved clipboard management Enhancement: Documentation improvement Enhancement: Corrected few typos #1 1.0.3
      Feature: Live synchronization Enhancement: Load the module only in the backend Enhancement: Documentation improvement 1.0.2
      Bug fix: Various bug fixes and improvements in JS functions Enhancement: Documentation improvement Enhancement: Corrected few typos 1.0.1
      Bug fix: Various bug fixes and improvements in the duplication process 1.0.0
      Initial release Support this module
      If this module is useful for you, I am very thankful for your small donation: Donate 5,- Euro (via PayPal – or an amount of your choice. Thank you!)
      Download this module (Version 2.0.1)
      > Github: https://github.com/FlipZoomMedia/InputfieldRepeaterMatrixDuplicate
      > PW module directory: https://modules.processwire.com/modules/inputfield-repeater-matrix-duplicate/
      > Old stable version (1.0.4): https://github.com/FlipZoomMedia/InputfieldRepeaterMatrixDuplicate/releases/tag/1.0.4
    • By flydev 👊🏻
      Current version: 1.3.14-ATO
      You can find the module on Github and in the modules directory :
      https://modules.processwire.com/modules/duplicator/ https://github.com/flydev-fr/Duplicator/archive/master.zip  
       
      Screenshots / Features
      Dir and files exclusion
       
      CRON job
       
      Advanced settings 
       
      Local and Cloud storage
       
      Changelog :
       
    • By NorbertH
      Is there a hook to do something right after cloning a page ?
      I want the page to be saved right after cloning it either from the button in the tree or from a lister, because saving the page triggers several calculations that are not triggered by just cloning the page.
       
      Thanks in advance !
    • By Andreas Augustin
      Hello!
      Can I deactivate the renaming feature of images and the editing (croping, rotating etc) in the processwire admin panel?
       
×
×
  • Create New...