SlickUpload
Welcome Guest Search | Active Topics | Log In | Register

How do I disable upload button until user selects a file Options
imsam67
#1 Posted : Wednesday, December 14, 2011 8:52:55 PM
Rank: Member

Groups: Registered

Joined: 11/22/2011
Posts: 17
Location: Florida

I want to make sure that users cannot click the "Upload" button unless he/she's selected at least one file.

How do I disable the upload button until there's at least one file to upload?


Thanks,
Sam
Axosoft
#2 Posted : Thursday, December 15, 2011 11:36:07 AM
Rank: Administration


Groups: Administrators

Joined: 7/7/2005
Posts: 1,586
Location: Scottsdale, AZ

I would suggest this:

  • Set the button disabled initially
  • Add handlers for OnClientFileAdded and OnClientFileRemoved that both point to a javascript onClientFileSelectionChanged function
  • In that function, check to see if there are files, and set enabled. Like this:
        
        function onFileSelectionChanged(data)
        {
            if (kw("<%=slickUpload.ClientID %>").get_Files().length > 0)
// TODO: set enabled
    else
// TODO: set disabled
        }
        
Will that work for you?

Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.