question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

FileUpload: default values of `invalidSizeMessage`, `invalidFileMessage` and `fileLimitMessage`

See original GitHub issue

Description

In the docs the default value of invalidSizeMessage, invalidFileMessage and fileLimitMessage is null but in ‘advanced’ mode these attributes have the following default values: ‘Invalid file size’, ‘Invalid file type’ and ‘Maximum number of files exceeded’.

For simple mode the default value is null. As an enhancement, the default value for simple mode could be the same as the ones in advanced mode.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
doleroncommented, May 22, 2020
  1. There is no validation or even a definition of allowTypes /invalidFileMessage in simple mode:

image

This is the code:

<h:outputText value="simple mode - default message" />
<p:fileUpload value="#{fileUploadView.file}" mode="simple" skinSimple="true" allowTypes="/(\.|\/)(png)$/" />
<h:outputText value="simple mode - custom message" />
<p:fileUpload value="#{fileUploadView.file}" mode="simple" skinSimple="true" allowTypes="/(\.|\/)(png)$/" invalidFileMessage="File type not allowed"/>
<h:outputText value="advanced mode - default message" />
<p:fileUpload value="#{fileUploadView.file}" mode="advanced" allowTypes="/(\.|\/)(png)$/"/>
<h:outputText value="advanced mode - custom message" />
<p:fileUpload value="#{fileUploadView.file}" mode="advanced" allowTypes="/(\.|\/)(png)$/" invalidFileMessage="File type not allowed"/>
0reactions
doleroncommented, May 22, 2020
  1. The displayed messages are nullified by using messageTemplate in combination with simple mode: image

Code:

<h:outputText value="simple mode - default template" />
<p:fileUpload value="#{fileUploadView.file}" mode="simple" skinSimple="true" sizeLimit="10240"/>
<h:outputText value="simple mode - custom template" />
<p:fileUpload value="#{fileUploadView.file}" mode="simple" skinSimple="true" sizeLimit="10240" messageTemplate="The file name is {name} and File size is {size}"/>
<h:outputText value="advanced mode - default template" />
<p:fileUpload value="#{fileUploadView.file}" mode="advanced" sizeLimit="10240"/>
<h:outputText value="advanced mode - custom template" />
<p:fileUpload value="#{fileUploadView.file}" mode="advanced" sizeLimit="10240" messageTemplate="The file name is {name} and File size is {size}"/>
Read more comments on GitHub >

github_iconTop Results From Across the Web

Primefaces FileUpload Component Example Tutorial
Today we will look into the Primefaces FileUpload component. ... invalidFileMessage, invalidSizeMessage and fileLimitMessage options are ...
Read more >
How to display p:fileUpload invalidFileMessage in p:growl
You can't handle this server side. The file type is validated at client side without hitting any code in server side.
Read more >
fileUpload (VDL Documentation Generator - PrimeFaces
When set true, process validations logic is executed at apply request values phase for this component. Default is false. required, false, javax.el.
Read more >
Problem with Primefaces fileUpload - Forums - Liferay
I'm trying to upload a PDF file with a primefaces 4 portlet on Liferay 6.2 ce. ... fileLimit="1" fileLimitMessage="Max 1 file" invalidFileMessage="Invalid ...
Read more >
How to replace template set by primefaces with Custom one?
I want to customize the fileupload UI component in the primefaces which inturn uses blueimp fileupload.js. I want to overwrite default primefaces template ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found