Re: Handling the fileuploadexception

2015-06-11 Thread Stephen Nutbrown
Hi again, apologies for multiple posts. I would actually really be interested in a file type validator as I am currently doing this on the server too - in the onValidateFromX, which fires after the upload has happened. I'll wait for some feedback on this one before creating a file type validator,

Re: Handling the fileuploadexception

2015-06-10 Thread Stephen Nutbrown
Hi, Yes, copying and adapting one for the validators is exactly what I did in the end using the twitter library they have. However, I found it a bit difficult to do because the current validator seems to use a coffee script (Something i'm not familiar with, I struggle with JS as it is!). So I

Handling the fileuploadexception

2015-06-09 Thread Stephen Nutbrown
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, 50); When the file is

Re: Handling the fileuploadexception

2015-06-09 Thread Thiago H de Paula Figueiredo
On Tue, 09 Jun 2015 14:42:44 -0300, Stephen Nutbrown steves...@gmail.com wrote: Hi, Hi! If there is no client side validation for the fileupload, is it possible (and not too difficult) for me to create one for the file upload component? Check the org.apache.tapestry5.validator.Required

Re: Handling the fileuploadexception

2015-06-09 Thread Thiago H de Paula Figueiredo
On Tue, 09 Jun 2015 14:39:54 -0300, Stephen Nutbrown steves...@gmail.com wrote: Hi Thiago, Hi! That's interesting. Perhaps the documentation wants updating. It says: Note the importance of return this;. A void event handler method, or one that returns null, will result in the

Re: Handling the fileuploadexception

2015-06-09 Thread Stephen Nutbrown
Hi, If I change it to void I get an uncaught exception and I end up going to my custom exception page (This just says something went wrong, logs the exception and returns the user to the homepage). If there is no client side validation for the fileupload, is it possible (and not too difficult)

Re: Handling the fileuploadexception

2015-06-09 Thread Thiago H de Paula Figueiredo
On Tue, 09 Jun 2015 14:05:49 -0300, Stephen Nutbrown steves...@gmail.com wrote: Hi, Hi! Object onUploadException(FileUploadException ex) { message = The file is too large, please resize it to be less than 500kb.; return this; } Never return this in an event handler unless you

Re: Handling the fileuploadexception

2015-06-09 Thread Stephen Nutbrown
Hi Thiago, That's interesting. Perhaps the documentation wants updating. It says: Note the importance of return this;. A void event handler method, or one that returns null, will result in the FileUploadException being reported to the user as an uncaught runtime exception.

Re: Handling the fileuploadexception

2015-06-09 Thread Stephen Nutbrown
Hi, I saw some posts on StackOverflow about validating files using JavaScript's files api (it looks fairly new so may not be suitable for projects which need to support old browsers):

Re: Handling the fileuploadexception

2015-06-09 Thread Thiago H de Paula Figueiredo
On Tue, 09 Jun 2015 19:01:33 -0300, Stephen Nutbrown steves...@gmail.com wrote: Hi, Hi! I saw some posts on StackOverflow about validating files using JavaScript's files api (it looks fairly new so may not be suitable for projects which need to support old browsers):