Skip to content

Instantly share code, notes, and snippets.

@wallace
Created March 31, 2009 01:11
Show Gist options
  • Save wallace/87991 to your computer and use it in GitHub Desktop.
Save wallace/87991 to your computer and use it in GitHub Desktop.
11 // element is expected to be a form element and contain a submit and file field
12 function update_form_with_progress_bar(element) {
13 // disable submit button
14 submit_button = element.down("input[type='submit']");
15 submit_button.disable();
16
17 // if file field has a value, display progress bar
18 file_field = element.down("input[type='file']");
19 if ( file_field != '' && file_field != null ) {
20 submit_button.hide();
21
22 // display or insert progress bar stuff here
23 }
24 }
<div id="pandaloader">
<div id="uploader">
<form id="upload" enctype="multipart/form-data" action="index.html" method="post">
<%= file_upload_field('', 'file') %>
<input type="submit" value="Upload">
</form>
</div>
<div id="progress" class="bar" style="width: 300px; background:#EEEEE none repeat scroll 0 0&nbsp; border: 1px solid #222222; margin-top:20px">
<div id="progressbar" style="background:#333333 none repeat scroll 0 0; height:24px; width:0px;">test&nbsp;</div>
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment