-
1. Re: Notification when file type rejected RF 4
brabbit27 Apr 18, 2012 11:30 AM (in response to brabbit27)Well finally I found a solution.
<rich:fileUpload id="fileUploadComp"
addLabel="Agregar" clearAllLabel="Quitar todos"
clearLabel="Quitar" deleteLabel="Quitar"
doneLabel="Completado" uploadLabel="Subir archivos"
fileUploadListener="#{uploadBean.doUpload}"
acceptedTypes="txt, csv" onclear="onclear(event);"
ontyperejected="ontyperejected();"
noDuplicate="true">
<a4j:ajax event="uploadcomplete" render="validationButton"/>
</rich:fileUpload>
<a4j:jsFunction name="ontyperejected" actionListener="#{uploadBean.setMessage()}"/>
<rich:notifyMessage stayTime="2000" nonblocking="true"/>with the backing bean
public void setMessage() {
String message="Wrong filetype...";
FacesContext.getCurrentInstance().addMessage("info", new FacesMessage(FacesMessage.SEVERITY_INFO, message, message));
}The only little problem I found in this is that If the user select the same file consecutively the message doesn't appear the second time. This is, select fileA.wrongType -> notification appears -> Select fileA.wrontType -> NO notification