-
1. Re: FileUpload - Disable UPLOAD (start) Button only
nbelaevski Feb 26, 2010 3:32 PM (in response to carvo)Hi,
You should be able to achieve this using CSS classes.
-
2. Re: FileUpload - Disable UPLOAD (start) Button only
carvo Feb 26, 2010 4:00 PM (in response to nbelaevski)Hi Nick,
thx for reply.
The doc is not clear enough, but how I do it? Do you have some sample code? Through this way, the OnClick event will be disabled?
Coz in the doc, there are one away to disable and is using $(..).component.disable(), but it disable all buttons.
Thx again.
Carvo.
ps. sorry my poor english.
-
3. Re: FileUpload - Disable UPLOAD (start) Button only
nbelaevski Feb 27, 2010 4:28 AM (in response to carvo)1 of 1 people found this helpfulEvery RichFaces component comes with a number of predefined rich-* classes (see component chapter in user guide for the list). So you can these classes to hide the button forever, not disable.
-
4. Re: FileUpload - Disable UPLOAD (start) Button only
carvo Mar 2, 2010 9:39 AM (in response to nbelaevski)Hi Nick,
thank you for your patience.
I read this chapter but did not find how to do this by predefined classes.
But as I said above, I did it using the ID of the button, but the event OnCancel overwrites my action. It's really depressing to use a component so complex that has not a simple beforeAdd (), beforeUpload (), beforeCancel () and etc (and their respective after methods), or even the independent control of its features (getStartButton or better, disable/enable startButton functions).
Thx again.
Carvo.
ps. I am saying this because I have another problem in the event OnAdd. At one point im trying to clear the list with $(..).component.clear(), but this is also overwritten later,and the list remains the same (the same before the OnAdd event fires).
-
5. Re: FileUpload - Disable UPLOAD (start) Button only
ilya_shaikovsky Mar 2, 2010 11:25 AM (in response to carvo)1 of 1 people found this helpfuldefine maxFilesQuantity attribute with EL which will be evaluated as 0 while conditions for upload not met. And then change when upload available via ajax rerendering the FU.
Unfortunatelly we added the same css classes for both buttons (a shame ) so just client side solution will not looks good as it will hide both buttons.
-
6. Re: FileUpload - Disable UPLOAD (start) Button only
carvo Mar 3, 2010 3:07 PM (in response to ilya_shaikovsky)Hi Ilya,
many thx for your reply.
I'm implementing a lot of validation (client and server) to prevent users from making sh.....
But I intend to use this time to gracefully ask that implements some "predefined class wrapper" methods like disableStartButton() and so on...
Thx for all help..
Carvo.
-
7. Re: FileUpload - Disable UPLOAD (start) Button only
ilya_shaikovsky Mar 4, 2010 3:00 AM (in response to carvo)created simple workaround:
<script> function switchUploadControl(id, expanded) { var button = $(id + ":upload2"); if(expanded) { Element.hide(button.parentNode); } else { Element.show(button.parentNode); } } </script> <rich:fileUpload fileUploadListener="#{fileUploadBean.listener}" maxFilesQuantity="#{fileUploadBean.uploadsAvailable}" id="upload" uploadControlLabel="<i>Upload1</i>" immediateUpload="#{fileUploadBean.autoUpload}" acceptedTypes="jpg, gif, png, bmp" allowFlash="#{fileUploadBean.useFlash}"> <a4j:support event="onuploadcomplete" reRender="info" /> </rich:fileUpload> <button type="button" onclick="switchUploadControl('#{rich:clientId('upload')}',false);">enable</button> <button type="button" onclick="switchUploadControl('#{rich:clientId('upload')}',true);">disable</button>
-
8. Re: FileUpload - Disable UPLOAD (start) Button only
carvo Mar 4, 2010 10:13 AM (in response to ilya_shaikovsky)I created something like that, but my problem comes after the OnClear event. If my validation fails (after OnClear), i need to hide the button, but the component show it again (like i said in first thread). So, i need to ask you "one" more thing: to create a before and after event methods (for those that not have, obviously).
Really thanks for your time.
CARVO.