-
1. RichFaces 4.0 CR1 and fileUpload
ilya_shaikovsky Mar 22, 2011 4:52 AM (in response to enfafi)just make the component not rendered after succesfull file upload (using onuploadcomplete), or navigate to the results page.. different options could be used according to your needs.
-
2. RichFaces 4.0 CR1 and fileUpload
enfafi Mar 23, 2011 4:34 AM (in response to ilya_shaikovsky)Hi Iliya, first of all, thanks four your answer.
But the user will be allowed to 'add' a lot of files that will be listed in the rich:fileUpload component, of course after the first successful upload I can hide the component, but it does not seams a good approach... (The user adds 6 files, press upload, system process the first file but ignore the rest, component is hide)
I've tried to hide the 'add' button after the user press on it, however I am not able to detect if he clicks on "Cancel" in the browser dialog for selecting the file. Because if he does, the 'add' button won't be enabled anymore.
Do you have any other ideas?
I will continue investingating, thanks for your support.
-
3. Re: RichFaces 4.0 CR1 and fileUpload
enfafi Mar 23, 2011 5:41 AM (in response to enfafi)Hi All,
I finally achieve what I were looking for. I have to override the uploadButton show & hide methods. What I'm doing in the code below is to hide Add button when Upload button is displayed, and display Add button when Upload button is hided.
In this way, user is only available to add one item to the upload files list.
$(document).ready(function(){ var oldShowUploadFunction = #{rich:component('uploadId')}.uploadButton.css; // Define overriding method. #{rich:component('uploadId')}.uploadButton.css = function(name, value){ #{rich:component('uploadId')}.addButton.hide(); // Execute the original method. oldShowUploadFunction.apply(this, arguments); }; var oldHideUploadFunction = #{rich:component('uploadId')}.uploadButton.hide; // Define overriding method. #{rich:component('uploadId')}.uploadButton.hide = function(){ #{rich:component('uploadId')}.addButton.show(); // Execute the original method. oldHideUploadFunction.apply(this, arguments); }; });
-
4. Re: RichFaces 4.0 CR1 and fileUpload
ilya_shaikovsky Mar 23, 2011 5:54 AM (in response to enfafi)sorry.. do not thought about that :)
Yup.. unfortunatelly for now you have to use workaround you listed.. because FU even have no handlers like onadd onremove in order to invoke custom JS which will be able to show/hide the buttons.
P.S. will include that into checklist while reviewing requirements for future versions for sure.