Wizard and Upload Progress Bar [Wizard+UploadProgressBar]

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Wizard and Upload Progress Bar [Wizard+UploadProgressBar]

Giuseppe Macrì
This post was updated on .
Hi Everyone,
I am trying to use UploadProgressBar into a wizard step to upload a file. Unfortunately I couldn't add the UploadProgressBar directly to WizardStep panel since the bar's constructor requires a form as input. I decide to create a form and add this to the wizard test. My code is the follow:


This is my wizard:

public class NewCaptureWizard extends Wizard {
        /**
         *
         */
        private static final long serialVersionUID = 1L;
       
        CaptureDto capture = new CaptureDto();
       
        public NewCaptureWizard(String id) {
                super(id);
               
                WizardModel model = new WizardModel();
                model.add(new NewCaptureVideoWizardStep(capture));
                this.init(model);
                this.getForm().setMultiPart(true);
                this.getForm().setMaxSize(Bytes.megabytes(750));
                System.out.println("Test");
        }
}




This is my wizardstep with a nested form

public class NewCaptureVideoWizardStep extends WizardStep {

        /**
         *
         */
        private static final long serialVersionUID = 1L;
       
        public NewCaptureVideoWizardStep(CaptureDto capture) {
                this.setModel(new CompoundPropertyModel(capture));
                this.add(new VideoUploadForm("form"));
        }
       

}



My form

public class VideoUploadForm extends Form {
       
        /**
         *
         */
        private static final long serialVersionUID = 1L;
       
       
        private FileUploadField fileUploadField;
       
        public VideoUploadForm(String name) {
                super(name, new CompoundPropertyModel(new UserCaptureDataModel()));
               
                setMultiPart(true);
                setMaxSize(Bytes.megabytes(750));
                fileUploadField = new FileUploadField("fileUpload");
                fileUploadField.setRequired(true);
                add(fileUploadField);
                add(new UploadProgressBar("progress", this));
               
        }
}

My wizardstep.html

<html xmlns:wicket>
        <wicket:panel>
                <fieldset>
                                <form wicket:id="form">
                                        <p>
                                                <label for="upload">File</label><br />
                                                <input wicket:id="fileUpload" id="upload" type="file" size="50"/>
                                        </p>
                                        <p>
                                                [[ajax upload progressbar]]
                                        </p>
                                        <input type="submit" value="Upload!"/>
                                </form>
                       
                </fieldset>
        </wicket:panel>
</html>


I can actually upload the file but the progress bar doesn't work.
If my wizard has several steps the nested form is always submitted with a null value when I click on next.
Do you have any idea how to show the progress bar during the upload? Do you know any other way to implement upload progress bar?
Thanks


Giuseppe



Giuseppe Macrì