nrnaveen / jquery-multifile-plugin

Automatically exported from code.google.com/p/jquery-multifile-plugin
0 stars 0 forks source link

a bug in combination: multiple file upload + jquery form + input hint #84

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Hi,

I am using 3 different types of plugin to validate a form, such as below,
[url]http://lauthiamkok.net/tmp/jquery/multifiles/form.php[/url]

below is the source of these plugins,
http://www.fyneworks.com/jquery/multiple-file-upload/
http://malsup.com/jquery/form/
http://onehackoranother.com/projects/jquery/jquery-grab-bag/input-hint.html

in using 'multiple-file-upload', you can use the maxlength property if you want 
to limit the number of files selected,

<form action="process.php" method="post" id="my-form" 
enctype="multipart/form-data">
        <p>E-mail<br />
        <input type="text" name="email" id="email" title="email"/></p>
        <p>File<br />
        <input type="file" name="upload[]" id="upload" class="multi" accept="gif|jpg" maxlength="2"/></p>
        <p><input type="submit" value="Submit" /></p>
    </form>

it works fine until i have installed the other two plugins - jquery form and 
input hint. 

now, whenever after I hit the submit button, the browse button appears to be 
able for selecting as many files as you wish even though I have limited the 
number in the file input field - maxlength="2".

first I found out that it was caused by the jquery form plugin, so then i tried 
to use if condition to disable the browse input button, but it still wont work,

if($('input[type=file]').length >= 3)
                    {
                        alert('hide me!');
                        //$('input:file').MultiFile('reset');
                        $('input[title]').inputHint();
                        $('input[type=file]').attr('disabled', 'disabled'); 
                    }

and I have found that it is actually the input hint causing that!

any ideas how to fix this??

the entire code is this,

$(document).ready(function() {

        $('input[title]').inputHint();
        $('#my-form').submit(function() { 
            $(this).ajaxSubmit({ 
                target: '#output',

                // dataType:  'xml', 
                // success identifies the function to invoke when the server response 
                // has been received 
                success: function() { 

                    alert($('input[type=file]').length);
                    if($('input[type=file]').length >= 3)
                    {
                        alert('hide me!');
                        //$('input:file').MultiFile('reset');
                        $('input[title]').inputHint();
                        $('input[type=file]').attr('disabled', 'disabled'); 
                    }
                } 
            }); 
            return false;

        }); 

    });

many thanks,
Lau

Original issue reported on code.google.com by iamt...@hotmail.co.uk on 27 Jul 2010 at 6:06

GoogleCodeExporter commented 8 years ago
The project has been dormant for over a year and many of the support requests 
have been resolved and/or are invalid. So we're going to archive them all, 
pending review.

If you're still having a problem with the plugin, please visit the project page 
and re-open the issue. We do apologize for any inconvenience this may cause, 
but please bear with us...  we'll be making improvements to the plugin and its 
documentation over the coming weeks.

Stay tuned; and thanks for your support!

The Fyneworks Team
http://twitter.com/fyneworks

Original comment by fyneworks on 26 Jan 2012 at 1:37