We have a file upload functionality. Max file upload size is 3 mb and we are validating the file size in component level.
using sizeLimit="3000000"
in p:fileUpload
component
We are displaying error message like following
Maximum file size allowed to upload is 3 MB.: XXX.pdf 7.5 MB
But my requirement is display the file size with two decimal points like following
Maximum file size allowed to upload is 3 MB.: XXX.pdf 7.53 MB
Is it possible to do?
I tried with messageTemplate
and jQuery but not able to do it.
One solution is overriding the method for size calculation, within PrimeFaces js, using the prototype.
The code then should looks like:
Doing this you're setting two decimals(the only difference I add with PF 6.2 js), both in the error message and in the detail one.