using with custom form
isaac77 - November 30, 2007 - 21:12
| Project: | Upload Progress |
| Version: | 5.x-1.4 |
| Component: | Miscellaneous |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Description
Thank you for this module! Two quick questions:
1.) Does this module prevent browser timeouts? I would like to allow users to upload very large files.
2.) Is there a way to easily use it with a custom form? My form is built with FAPI (on drupal 5.3).
I have hacked upload_progress.module to make it work with my form as follows, but perhaps there is a cleaner way?
- Hard code the following into my custom form:
<div id="sending" class="progress" style="display: none;">
<div class="status">Please wait. Uploading...</div>
<div class="bar"></div>
</div> -
Modify the following code from upload_progress.js
/**
* Attaches the upload behaviour to the video upload form.
*/
Drupal.upload_progress = function() {
$('#node-form').submit(Drupal.upload_progress_hide_timeout);
}
by changing $('#node-form') to $('#id of my custom form)
These changes get the progress bar to appear at the bottom of the form after "submit" is clicked. However, the form itself does not disappear upon submission. This makes for strange behavior when the browser's "back" button is used: the form appears with the progress bar already in motion.
Thanks for your help!

#1
Hi,
No this module does not prevent browser timeout. However, if your are uploading files, your browser should not timeout since it is doing something (uploading the file).
I wrote this module with the node edition form in mind. I think what you did is the best way of making it work with your form. To get the form hiding behavior, be sure to replace all instances of '#node-form' by '#id of my custom form' in upload-progress.js.
Maybe we could add some configuration parameter to the module so people would be able to type the form ids for which they would like to have upload progress... I don't know if it is very user friendly though...
Patrick
#2
Changing issue to feature request.