Javascript error?

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-- <iframe

id=“UploadTarget1” name=“UploadTarget1” src=“”
style=“width:0px;height:0px;border:0”>

–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

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:

Hope this helps,

Ben

On 6/16/06, Ryan S. [email protected] wrote:

but no requests in between. I read in the doc that there should be

Object.extend({asynchronous:true, evalScripts:true,
class=“foreground”><div class=“uploadStatus”
<%= submit_tag ‘Upload’ %>


Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails


Ben R.
303-947-0446
http://www.benr75.com

Yeah, that did it. That was pretty stupid. I’ve been working with Ajax
a
lot in with this app, but this page was using the wrong layout… one
that
didn’t include that javascript. But I’m still having a couple issues:

The status bar remains at 0% until the upload finishes. Then it jumps
to
100%. I’ve looked at the rails log and it seems that my page sends a
bunch
of upload_status requests before the upload even starts. Then, it
starts
the upload, but no upload_status requests are processed until it has
finished. It is as if there is only one connection being made, but I’m
using fcgid… so the default min processes is 3 right?

Thanks, Ryan

View this message in context:
http://www.nabble.com/Javascript-error--t1800472.html#a4909146
Sent from the RubyOnRails Users forum at Nabble.com.