Question re: .rjs files

I’m in Chapter 9, “Add A Dash of AJAX”. I created the add_to_cart.rjs
file using RadRails. When I re-load the index page, the “Add to Cart”
button disappears. Also, I’ve noticed that the file type in Windows
Explorer for my “add_to_cart.rjs” file is “RealSystem Skin”. I’ve
checked both my browsers, Internet Explorer and Firefox, and I have
javascript enabled. I don’t understand where “RealSystem Skin” comes
in.

Kenny Mr wrote:

I’m in Chapter 9, “Add A Dash of AJAX”. I created the add_to_cart.rjs
file using RadRails. When I re-load the index page, the “Add to Cart”
button disappears. Also, I’ve noticed that the file type in Windows
Explorer for my “add_to_cart.rjs” file is “RealSystem Skin”. I’ve
checked both my browsers, Internet Explorer and Firefox, and I have
javascript enabled. I don’t understand where “RealSystem Skin” comes
in.

Can you paste the RJS file here ?

Windows guess at what type of file it is, isn’t really relevant I’d have
thought. I assume the extension is registered as some kind of skin for
Real Player (?).

A.

Alan F. wrote:

Kenny Mr wrote:

I’m in Chapter 9, “Add A Dash of AJAX”. I created the add_to_cart.rjs
file using RadRails. When I re-load the index page, the “Add to Cart”
button disappears. Also, I’ve noticed that the file type in Windows
Explorer for my “add_to_cart.rjs” file is “RealSystem Skin”. I’ve
checked both my browsers, Internet Explorer and Firefox, and I have
javascript enabled. I don’t understand where “RealSystem Skin” comes
in.

Can you paste the RJS file here ?

Windows guess at what type of file it is, isn’t really relevant I’d have
thought. I assume the extension is registered as some kind of skin for
Real Player (?).

A.

The rjs file (I’ve just looked) replaces the HTML div with id = ‘cart’
with a rendered partial. If, for some reason, that partial failed to
render, you’d get the behavious you describe.

Have you restarted the server ?

A.

Alan F. wrote:

Alan F. wrote:

Kenny Mr wrote:

I’m in Chapter 9, “Add A Dash of AJAX”. I created the add_to_cart.rjs
file using RadRails. When I re-load the index page, the “Add to Cart”
button disappears. Also, I’ve noticed that the file type in Windows
Explorer for my “add_to_cart.rjs” file is “RealSystem Skin”. I’ve
checked both my browsers, Internet Explorer and Firefox, and I have
javascript enabled. I don’t understand where “RealSystem Skin” comes
in.

Can you paste the RJS file here ?

Windows guess at what type of file it is, isn’t really relevant I’d have
thought. I assume the extension is registered as some kind of skin for
Real Player (?).

A.

The rjs file (I’ve just looked) replaces the HTML div with id = ‘cart’
with a rendered partial. If, for some reason, that partial failed to
render, you’d get the behavious you describe.

Have you restarted the server ?

A.

The file in question is

page.replace_html(“cart”, :partial => “cart”, :object => @cart)

I did restart the server when I got the error.

Kenny Mr wrote:

The rjs file (I’ve just looked) replaces the HTML div with id = ‘cart’
with a rendered partial. If, for some reason, that partial failed to
render, you’d get the behavious you describe.

Have you restarted the server ?

A.

The file in question is

page.replace_html(“cart”, :partial => “cart”, :object => @cart)

I did restart the server when I got the error.

And now, with the restarted server, you dont see the cart when you first
hit the page, or does it only disapper when you add something ?

Because, if it’s on the first hit of the page, it’s not RJS thats the
problem. It only gets triggered when you add to cart.

Alan F. wrote:

And now, with the restarted server, you dont see the cart when you first
hit the page, or does it only disapper when you add something ?

Because, if it’s on the first hit of the page, it’s not RJS thats the
problem. It only gets triggered when you add to cart.

When I reload, I’m able to see my catalog page, but the “Add To Cart”
button is gone. The only button on the page is “Empty Cart”.

Kenny Mr wrote:

Alan F. wrote:

And now, with the restarted server, you dont see the cart when you first
hit the page, or does it only disapper when you add something ?

Because, if it’s on the first hit of the page, it’s not RJS thats the
problem. It only gets triggered when you add to cart.

When I reload, I’m able to see my catalog page, but the “Add To Cart”
button is gone. The only button on the page is “Empty Cart”.

I’m not sure what you mean by reload. :slight_smile:

If you open a brand new browser and hit the page for the first time (ie
dont just hit refresh), is the cart hidden or visible ?

A.

Alan F. wrote:

I’m not sure what you mean by reload. :slight_smile:

If you open a brand new browser and hit the page for the first time (ie
dont just hit refresh), is the cart hidden or visible ?

A.

Cart is visible. “Add To Cart” button does not display.

Kenny Mr wrote:

Alan F. wrote:

I’m not sure what you mean by reload. :slight_smile:

If you open a brand new browser and hit the page for the first time (ie
dont just hit refresh), is the cart hidden or visible ?

I just tried creating a .rjs file here at work using Dreamweaver MX.
When I check the extension in the Windows Explorer directory, the file
type is RJS. My Internet Explorer version here at work is 6, my IE
version at home is 7. I use Windows XP Home edition both at home and
work. I also tried creating one using Notepad - same results. I used
both Radrails and Cute HTML at home for my .rjs file, but it shows file
extension as RealSystem Skin. I don’t have the RealPlayer software on
my pc at work. Did at home, but I have uninstalled it, hoping that
would make a difference.

Kenny Mr wrote:

When I check the extension in the Windows Explorer directory, the file
type is RJS. My Internet Explorer version here at work is 6, my IE
version at home is 7. I use Windows XP Home edition both at home and
work. I also tried creating one using Notepad - same results. I used
both Radrails and Cute HTML at home for my .rjs file, but it shows
file extension as RealSystem Skin. I don’t have the RealPlayer
software on my pc at work. Did at home, but I have uninstalled it,
hoping that would make a difference.

Windows has an internal register of what each file type is (depending on
when a piece of software registers itself as capable of handling a file
type) - I guess when the RealPlayer was set up, it registered RJS as a
file type it handles. Now, any file with that extension will show up
with that explanation. Perhaps, a search on de-registering a program
from handling a file extension will help. It must be in the registry, I
guess - on my PC, it seems to be under “My
Computer\HKEY_CLASSES_ROOT…” the … = the extension in question,
example .aiff or .rjs

I’m not sure what you can do with that information, though :stuck_out_tongue:

On the other hand, if all you want to achieve is that the file open with
a different program, then right click on the file and select the “Open
With…” option and scroll down to “Choose Program…” and then “Select
from a list” and finally browse/ scroll to the program that you want to
open this file with. Remember to check the box “Always use the selected
program to open this kind of file” - thereafter, it will open with that
program.

I hope this helps… hope, I didn’t completely misunderstand your
question :smiley:

Cheers
Mohit.

Update:

Removed RealPlayer on my home PC. .rjs extension on my computer at home
is now being read as just that, rjs for ruby javascript. Just a few
minutes ago, I started off fresh. Started Radrails, Started Instant
Rails and loaded Ruby Console Server. Started my browser. Typed in the
URL http://localhost:3000/store. My catalog page shows up, but still
the “Add To Cart” button is gone.

Hi Kenny,

I am facing the same problem of not being able to see “Add to Cart”
button although i see “empty cart” while coding as per Chapter 9 of ROR
book (2nd ed.). I am working on Linux. Did u find the solution for your
problem? Any pointers that can solve this conundrum would help me sleep
:slight_smile:

Preet.

eff6 wrote:

Hi Kenny,

I am facing the same problem of not being able to see “Add to Cart”
button although i see “empty cart” while coding as per Chapter 9 of ROR
book (2nd ed.). I am working on Linux. Did u find the solution for your
problem? Any pointers that can solve this conundrum would help me sleep
:slight_smile:

Preet.

I still haven’t come across a solution. Sorry.

Hi Kenny!

I just found the solution for our problem!!

Use this code in index.rhtml and it will like a charm (at least it did
for me):

<%= form_remote_tag (:url => { :action => :add_to_cart, :id => product
}) %>
<%= submit_tag (“Add to Cart”) %>
<%= end_form_tag %>

There are mainly 4 changes:

  1. Open the form_remote_tag with <%= instead of <%
  2. remove “do” at the end of “form_remote_tag” closure
  3. Coreesponding END tag for ‘form_remote_tag’ is “end_form_tag” and
    not “end”
  4. Don’t forget to include ‘<%=’ in front of “end_form_tag” instead of
    just <% or else ur cart will not work correctly.

All the best!!

Preet

Preet: Yes it worked. Then I went on to the next chapter and other
errors have developed. Thanks for your post, though - sorry I haven’t
said that before now.

Preet wrote:

Hi Kenny!

I just found the solution for our problem!!

Use this code in index.rhtml and it will like a charm (at least it did
for me):

<%= form_remote_tag (:url => { :action => :add_to_cart, :id => product
}) %>
<%= submit_tag (“Add to Cart”) %>
<%= end_form_tag %>

There are mainly 4 changes:

  1. Open the form_remote_tag with <%= instead of <%
  2. remove “do” at the end of “form_remote_tag” closure
  3. Coreesponding END tag for ‘form_remote_tag’ is “end_form_tag” and
    not “end”
  4. Don’t forget to include ‘<%=’ in front of “end_form_tag” instead of
    just <% or else ur cart will not work correctly.

All the best!!

Preet