I’m running through the examples in Cody F.'s “RJS Templates for
Rails” PDF and have hit a small snag.
Have implemented the first part of the expense tracker app, up to the
section about FireBug. All is OK if I try the show view and add an
expense from within Mozilla Firefox. However, if I try it from within
IE and add an expense, I get a pop-up window
RJS error:
[object Error]
then after clicking OK get another pop-up with
new Insertion.bottom(“expenses”, "<tr id=“expense-17”>
test
<td class=“amount”>200.00
");
new Effect.Highlight(“expense-17”,{});
Form.reset(“expense-form”);
If I refresh the show page the new entry is shown (i.e. made it into the
d/b)
I certainly don’t know enough about JS to work out what might be wrong
with the above specific to IE.
Any one else had this issue or know why this might be happening?
The popups are just debug RJS, basically it tries to run the javascript
and
if it fails, an alert is called with the code it tried to run. Make sure
that the elements you are tryinig to access (expenses, expense-17) are
set
up correctly (names vs ids). IE might act differently than Firefox (I
can’t
remember right off hand) when it comes to accessing DOM elements through
id’s or name’s. I’d have to see the accompaning HTML to know for sure.
The popups are just debug RJS, basically it tries to run the javascript
and
if it fails, an alert is called with the code it tried to run. Make sure
that the elements you are tryinig to access (expenses, expense-17) are
set
up correctly (names vs ids). IE might act differently than Firefox (I
can’t
remember right off hand) when it comes to accessing DOM elements through
id’s or name’s. I’d have to see the accompaning HTML to know for sure.
Jason
The code is pulled straight from the book, so hope it’s OK to reproduce
a snippet of the code here
So you can see how the DOM ids/names are setup. Does this highlight
what might be the cause?
(Therefore, the error I first posted relates to me adding a new expense
which ends up with an id of 17.)
Thanks
Karen
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.