All sources are wrapped by divs, except for the default upload form element and its button. Using a form styling library like uniform.js doesn't work in this case because the "display: none/block" is added as a style attribute on the element itself. Uniform hides the original element and relies on it staying hidden. :) but switching sources of course hides and unhides, attribute styles taking a higher priority and therefore unhiding the element.

There should be a way tho, by using a hook to wrap the element into a container. Maybe this one: http://api.drupal.org/api/drupal/modules%21file%21file.field.inc/functio...

Thanks,

Oliver

CommentFileSizeAuthor
#1 wrapdefaultelement-1897694-2.patch1.74 KBAnonymous (not verified)

Comments

Anonymous’s picture

Status: Active » Needs review
StatusFileSize
new1.74 KB

So, well I created a little patch based on the latest dev (*cough cough* my first patch EVER *taking out the champagne*) which wraps the input elements of the default upload element into a container for each filefield_sources widget on a form.

Applying uniform.js to an <input type="file" /> and things like http://drupal.org/project/autoupload now work with filefield_sources. Yay! :-)

Let me know what you think..

Anonymous’s picture

I stand corrected: AutoUpload doesn't work because it chokes on the wrapper div.

quicksketch’s picture

Status: Needs review » Needs work

Hi @genox. I'm not sure about this patch. FIleField Sources tries to not interfere with the existing markup of the FileFIeld (other than adding the parts it needs). It doesn't add any wrappers to anything, for fear that it would break specific selectors used by other modules (perhaps like the autoupload.module you mentioned). Overall this seems like a bigger risk than reward, so I'd prefer to "won't fix" this issue.

I'm saddened that your first ever patch is met with such scrutiny. I really appreciate new contributors. :)