Hi,

I have a page with a form on, one field is a FileUpload. It takes a
while for the user to fill out this form. The validation is set to
limit the upload to 500kb, I have done this by adding this to the
AppModule:

      configuration.add(UploadSymbols.FILESIZE_MAX, "500000");


When the file is too large, an exception is thrown and a page event is
triggered which looks a bit like this:

Object onUploadException(FileUploadException ex) {
    message = "The file is too large, please resize it to be less than 500kb.";
    return this;
}

I'm following the information in the documentation
here:https://tapestry.apache.org/uploading-files.html

My two problems/questions are:
1- If I record an error on the form using something like:
createForm.recordError("Your file is too big");
This does not show. I have worked around this by adding a message
property which is checked and if it's not null, we show it on the
page. It is persisted with the Flash strategy, this seems to work, but
isn't ideal as it would be nice to have all the validation done in the
same way.

2- It then clears the form. Unfortunately the other parts of the form
are not persisted. Perhaps this is because T5 cut stopped the client
finishing the POST request (maybe a good thing), I am not sure. Is
there anything that can be done to persist the rest of the data so the
user doesn't then need to do everything again?

I think ideally (what I envisage) is some client side validation of
the file size which means the request is never sent, so we don't need
to worry about persistance, and perhaps we can show the error on the
field itself (just like how validate works on other fields, like
validate="required", but for this perhaps validate="<500000".

Is this possible? I would think this is a fairly normal requirement,
so i'd be surprised if it's not already somehow done.

Thanks,
Steve

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

Reply via email to