Welcome Guest Search | Active Topics | Sign In | Register

AjaxUpload Component Options
markw
Posted: Sunday, July 20, 2008 11:52:55 AM
Rank: Member
Groups: Member

Joined: 11/12/2007
Posts: 27
Hello,

I have a website that uses the Ajaxupload component

one issue the client has is they have to browse then upload an image then click the continue button to complete on the page as there is other information to fill in on the page - it would be nice is the Ajaxupload component allowed the upload button to be clicked even if a file is not uploaded thus in the template i could rename the button to upload/continue which would offer a one click continue even if the optional file was not uploaded?

Regards
Markw
eo_support
Posted: Sunday, July 20, 2008 1:10:19 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,193
Hi,

The file upload and other form elements always go separately (otherwise it wouldn't be called AJAX uploader). However you can set the uploader's AutoPostBack to true so that once the file is done, it immediately automatically submits other form elements. This way your user will only need to click the "Upload" button --- of course you can change the "Upload" text to whatever you would like.

Thanks
markw
Posted: Sunday, July 20, 2008 1:42:40 PM
Rank: Member
Groups: Member

Joined: 11/12/2007
Posts: 27
True, but the problem comes if there is other information to be posted back aswell as in other fields that are required then the validation gives a message please fill in your name (as an example) then the next postback can not be the ajaxupload button another button is then required for this?

so the steps are:

1. Browse/upload a file
2. save - where the validation occurs

which is 3 clicks

it would be better if
1. save - using the ajaxupload button then validation occurs ie 1 click for data and the file upload?

to use the ajaxupload as the 'save' button if the validation fails i.e not enough fields filled due to only 1 file maximum on the upload
you therefore need another button save again? to resubmit the information

Regards
Markw

markw
Posted: Sunday, July 20, 2008 1:44:35 PM
Rank: Member
Groups: Member

Joined: 11/12/2007
Posts: 27
The problem is that the file is not mandatory therfore unless you browse to a file the ajaxupload button is not enable to submit the information?

As a solution to this is it possible to enable the upload button (renamed to Save/Update etc) even if no file is selected therefore i can process on the postback the other information and show fields missing or complete accordingly?
eo_support
Posted: Sunday, July 20, 2008 2:41:25 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,193
Hi,

We can think of one way that might work for you. It will be as follow:

1. Change LayoutTemplate to hide the default upload button. Note the button should not be removed; It is merely not visible. For example, you can put it inside a hidden div;
2. Replace your submit button with a simple HTML button so that by default it does not post back the page;
3. Handle the button's onclick event:

Code: JavaScript
function click_handler()
{
    //Get the upload button
    var uploadButton = 
        document.getElementById("AJAXUploader1_UploadButton");

    if (uploadButton.disabled)
    {
        //Raises a normal post back if the upload button is disabled
        //you will need to replace arguments to __doPostBack with
        //appropriate values
        __doPostBack(....);
    }
    else
    {
        //Otherwise go ahead with the upload, once the upload is
        //is done the uploader will automatically submits the rest,
        //assuming AutoPostBack is set to true
        AJAXUploader1.upload();
    }
}


There are two problems with this code:
1. It relies on our implementation details (with hardcoded UploadButton ID value);
2. It can fail if user selects a file that IE does not have permission to access; which causes uploadButton.disabled to be false (since a file is selected) but upload to fail. In reality this rarely happens because if user is able to select the file, he usually has read permission on that file;

The ideal solution is to extend upload to the uploader's client side API so that you will be able to query:

1. Whether user have selected any files;
2. Whether the upload was successful;

We will look into that and see if it is possible for us to add that.

Thanks
markw
Posted: Sunday, July 20, 2008 3:02:45 PM
Rank: Member
Groups: Member

Joined: 11/12/2007
Posts: 27
Excellent idea as a work around and i think it should do the job!

I will implement it tommorow and let you know the outcome - yet again thankyou so much for your very quick response on this issue.

Markw
eo_support
Posted: Thursday, July 24, 2008 7:01:56 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,193
Hi,

We have posted a new build that added ClientSideOnCancel event on AJAXUploader. Please see your private message for download location.

With this additional event you should be able to post back the page when the uploader didn't go through; and otherwise let the uploader to postback the page for you. A new sample has also been added to demonstrate this feature.

Thanks


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.