Plugins

The plugins site is currently in development.

We've been looking to provide a higher-quality, spam-free experience at the plugins site for some time, and a major error on our part forced us to shut down the current site before we could put the new one in place. We are developing a new site, and you can follow along with its development on GitHub. For more information about this transition, including steps you can take as a plugin author to prepare, please read our post about what's going on.

Using programmatic declaration method with 2 input fields


Project:Multiple File Upload
Version:1.2.4
Component:User interface
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

Hi, I tend to prefer the programmatic declaration method, but it has one bug : when I declare 2 fields to be multi that way (using ids), the plugin works fine except that the list of files writes below the first declared field. Easily reproduced, understand ?

# Method 2: Programatically (without MetaData plugin)

$(function(){
$('#PortugueseFileUpload').MultiFile({
STRING: {
remove:'Remover',
selected:'Selecionado: $file',
denied:'Invalido arquivo de tipo $ext!'
}
});
});

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

#1

That's not a bug, it's a behavioural design. I *could* work around it, but you should never have 2 elements with the same ID anyway. All IDs on a page must be unique. Chaging the plugin so it allows 2 elements with the same ID would be something Microsoft might do...

So, the proper way of doing this is, instead of using the ID, use the class property:

$(function(){
$('.file-pt').MultiFile({
STRING: {
remove:'Remover',
selected:'Selecionado: $file',
denied:'Invalido arquivo de tipo $ext!'
}
});
$('.file-en').MultiFile({
STRING: {
remove:'Remover,
selected:'Selected: $file',
denied:'Invalid file type: $ext!'
}
});
});

#2

No the bug occured with two different forms with file input with different ids within the same page

of course I meant 2 unique ids

<form name=form1>
<input type="file" name="frminput1" id="frminput1" class="myclass">
</form>

<form name=form2>
<input type="file" name="frminput2" id="frminput2" class="myclass">
</form>

#3

I forgot to say congratulations for your plugin by the way, and great follow up

#4

Hi,

I'm sorry about the misunderstanding...
I've set up a test page and it all seem to be working correctly.
http://www.fyneworks.com/jquery/multiple-file-upload/test.html

The problem could be in your form submission, or it may be something related to your code. Could you upload a test page so I can observe the bug in action?

#5

try this on IE to get used to the form

http://webxadmin.free.fr/demo/strangeform/file.htm

then on Firefox to debug if you wish :)

let me know I'll remove this ASAP

this is a complex form I admit :)

good luck :)

#6

Hi,

I found the problem. When you called the plugin twice (using 2 different ID calls) the counter would reset and the plugin would use the same ID for the list of 2 different elements.

I changed the counter scope to global, so instead of 1, 1 it will now go 1, 2 even when you use 2 calls.

Please download the latest version from here:
http://www.fyneworks.com/jquery/multiple-file-upload/jquery.MultiFile.js

...I've tried it, but please test it on your form and let me know that it works.

Thanks,
Diego A.

#7

amazing job . Problem solved

#8

Status:active» closed

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.