so is the problem that the form being submitted is the outer form and
it doesnt support the inner form's maxsize?

-igor

On Fri, Sep 4, 2009 at 9:10 AM, nytrus<nytrus...@gmail.com> wrote:
>
> Yes igor, below there is the code, even if is not very short.
> The issue is that when I click on upload1 button the submitting form is
> form0 instead of simpleUpload.
> Maybe I've bad-coded some part.
>
> /** the upload panel, very similar to the wicket example **/
> public class UploadFilePanel extends Panel {
>    /**
>     * Form for uploads.
>     */
>    private class FileUploadForm extends Form<Void> implements
> IFormVisitorParticipant{
>        private FileUploadField fileUploadField;
>        public FileUploadForm(String name, IModel<FileUpload> model, Bytes
> maxSize){
>            super(name);
>            // set this form to multipart mode
>            setMultiPart(true);
>            // Add one file input field
>            add(fileUploadField = new FileUploadField("fileInput", model));
>            setMaxSize(maxSize);
>        }
>
>       �...@override
>        protected void onSubmit(){
>            final FileUpload upload = fileUploadField.getFileUpload();
>            if (upload != null){
>                // Create a new file
>                File newFile = new File(getUploadFolder(),
> upload.getClientFileName());
>                try{
>                    // Save to new file
>                    newFile.createNewFile();
>                    upload.writeTo(newFile);
>                    FileUploadForm.this.info("saved file: " +
> upload.getClientFileName());
>                }
>                catch (Exception e){}
>            }
>        }
>    }
>
>    public UploadFilePanel(String id, Bytes maxSize) {
>        super(id);
>
>        // Add simple upload form, which is hooked up to its feedback panel
> by
>        // virtue of that panel being nested in the form.
>        if (maxSize==null) maxSize = Bytes.kilobytes(100);
>        final FileUploadForm simpleUploadForm = new
> FileUploadForm("simpleUpload", new Model<FileUpload>(null), maxSize);
>        add(simpleUploadForm);
>
>        final FeedbackPanel uploadFeedback = new
> FeedbackPanel("uploadFeedback", new ContainerFeedbackMessageFilter(this));
>        add(uploadFeedback);
>    }
> }
> /** the panel html **/
> <html xmlns:wicket>
> <wicket:panel>
>    <form wicket:id="simpleUpload">
>            <input type="file" wicket:id="fileInput"/>
>      <input wicket:id="submit" type="submit" value="submit"/>
>    </form>
>    <div wicket:id="uploadFeedback" />
> </wicket:panel>
> </html>
>
>
> /** the test page **/
> public class TestPage extends WebPage {
>        Form<?> form0 = new Form("form0");
>        UploadFilePanel upload0 = new UploadFilePanel("upload0",
> Bytes.kilobytes(100));
>        form0.add(upload0); /*** this upload DOES NOT check max size ***/
>        add(form0);
>
>        UploadFilePanel upload1 = new UploadFilePanel("upload1",
> Bytes.kilobytes(100));
>        add(upload1); /*** this upload DOES check max size ***/
> }
> /** test page html **/
> <wicket:extend>
> <form wicket:id="form0">
>        <div wicket:id="upload0" />
> </form>
> <div wicket:id="upload1" />
> </wicket:extend>
>
>
>
>
> igor.vaynberg wrote:
>>
>> perhaps if you showed your code it would be more clear.
>>
>> -igor
>>
>
> --
> View this message in context: 
> http://www.nabble.com/Form-FileUploadField-maxSize-does-not-work-tp25293039p25297271.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to