Are you including the prototype.js libraries in your view? If not add
this to your head section of your layout or view:
<%= javascript_include_tag(:defaults) %>
Will add:
<script src="/javascripts/prototype.js"
type="text/javascript"></script>
<script src="/javascripts/effects.js"
type="text/javascript"></script>
<script src="/javascripts/dragdrop.js"
type="text/javascript"></script>
<script src="/javascripts/controls.js"
type="text/javascript"></script>
Hope this helps,
Ben
On 6/16/06, Ryan Scudellari <scudellari@gmail.com>
wrote:> Hi, I''m trying to get this progress bar plugin working, but
I''m
> having some trouble.
>
> I''m running Apache 2.0.52 with mod_fcgid on Mac OS X. Everything
> seems to be working fine, but the progress bar simply doesn''t
work.
> In my log I get:
>
> Multipart upload with progress (id: 1, size: 176731770)
> Finished processing multipart upload in 18.96244s
>
> but no requests in between. I read in the doc that there should be
> requests in between to get the upload status... but it looks like
> either my browser isn''t even making the requests or the server
doesn''t
> have enough processes to handle it. Anyway, I''m getting this
> javascript error in Firefox when I click ''Upload'':
>
> Error: $ is not defined
> Source File: http://photos/album/new/4
> Line: 1
>
> Line 1 is simply:
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
>
> with no $ to be found... so this line number is clearly wrong. I am
> assuming it is coming from the generated javascript from the plugin
> helpers. Is this what is preventing the requests from being made?
> How do I go about fixing it?
>
> Thanks, Ryan
>
> Here is all the relevant code:
>
> --Generated HTML--
>
> <form action="/album/new/4"
enctype="multipart/form-data"
> method="post" onsubmit="if
(this.action.indexOf(''upload_id'') < 0){
> this.action += ''?upload_id=1''; }this.target >
''UploadTarget1'';$(''UploadStatus1'').innerHTML=''Upload
starting...'';
>
if($(''UploadProgressBar1'')){$(''UploadProgressBar1'').firstChild.firstChild.style.width=''0%''};
> new Effect.Appear(''status''); if (document.uploadStatus1)
{
> document.uploadStatus1.stop(); }document.uploadStatus1 = new
>
Ajax.PeriodicalUpdater(''UploadStatus1'',''/album/upload_status?upload_id=1'',
> Object.extend({asynchronous:true, evalScripts:true,
>
onComplete:function(request){$(''UploadStatus1'').innerHTML=''Upload
>
finished.'';if($(''UploadProgressBar1'')){$(''UploadProgressBar1'').firstChild.firstChild.style.width=''100%''};document.uploadStatus1
> = null; $(''message'').innerHTML >
arguments[0]}},{decay:1.8,frequency:2.0})); return true"><iframe
> id="UploadTarget1" name="UploadTarget1"
src=""
> style="width:0px;height:0px;border:0"></iframe>
> <input id="album_file" name="album[file]"
size="30" type="file" />
> <input name="commit" type="submit"
value="Upload" />
> <div class="progressBar"
id="UploadProgressBar1"><div
> class="border"><div class="background"><div
>
class="foreground"></div></div></div></div><div
class="uploadStatus"
> id="UploadStatus1"></div>
> </form>
>
>
> --View--
>
> <%= form_tag_with_upload_progress({:action =>
''new''}, {
> :begin => "new
Effect.Appear(''status'')",
> :finish => "$(''message'').innerHTML =
arguments[0]" }) %>
> <%= file_field :album, :file %>
> <%= submit_tag ''Upload'' %>
> <%= upload_status_tag %>
> <%= end_form_tag %>
>
> --Controller--
>
> upload_status_for :new
>
> def new
> ...
> end
> _______________________________________________
> Rails mailing list
> Rails@lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>
--
Ben Reubenstein
303-947-0446
http://www.benr75.com