2 onchange functions - 1 jquery, 1 prototype - not working in safari

Hi all,

Im using the jNice plugin on a select box in a form of mine. Im also
calling a custom JS function which uses prototype on the same select
box.

<%= f.collection_select :item_name, Item.all, :item_for_order, :name,
{ :name => "select", :onchange => "item_row($(this));"} %>

now both jNice and item_row() work in FF when i change the selected
value. But it does not work in Safari. In safari, the page jumps to
the top when i click on a selection, if i click on it again, jNice
works. item_row() does not.

Now im not sure what the problem is. Im using jQuery.noConflict to
avoid conflict between the two libraries and otherwise, the JS heavy
page is working fine.

Anyone with any experience/ tips on this one?

Vinay.

i narrowed down the issue to one line of code in the item_row
function. it tries to insert a value into a hidden_field which is kind
of hanging inside <tr> tags. Here's the HTML and JS code..

HTML

hi
i faced the similar prob b4 1 month and then i find out this solution
cange
the function from onchange to onclick. this onchange not works with
IE7
as well.ff works perfectly.

nirosh

I actually just solved it by putting the hidden_field inside another

instead of leaving it hanging outside. I have not checked in IE7. thanks for the heads-up! :slight_smile:

Anything wrong with my HTML structure that Safari is rejecting?

You shouldn;t have an input element there - The direct children of a
tr tag should only be td tags (or similar (th etc.))

Fred

Hmmm… this is what I have now. Is this ok?

        <input class="item_id" id="order_item_id" name="order[item_id]" type="hidden" />

        ....

 </td>
 <td>....</td>

 
 <td>
       <%= f.collection_select :item_name,

Item.all, :item_for_order, :name, { :name => “select”, :onchange =>
“item_row($(this));”} %>

Im actually having another interesting issue with this table structure im having. I provide a link to add another row to the table. The structure is like this…

HTML