Javascript Error in IE Using the Prototype library in Rails -


I am running a rail application and using prototype. The script breaks in IE, but works in all other browsers. I appreciate any help in guessing for any fix for this.

Here's the problem:
My users sell varieties of products and products. The available varieties are dependent on the product. For example, if we are talking about the fruit, then the user can choose the product "apple", so I have to show different kinds of apples to choose it instead of all the varieties on the whole site.

I use javascript to limit dropdown options for varieties so that they depend on the selected product before the dropdown. So if the user selects the product "apple", then the diverse list is dynamically limited to the varieties of apples. It works great in all browsers, of course, IE.

When I select a product from the dropdown, the script fails and the error message "object does not support this property or method"

I believe The problem and the solution have been explained on the following page if you scroll down - the section with the original extension name:

Unfortunately, I'm not very good Javascript is not yet and I do not know that Prototype type Based on the explanation on the page, how to fix this problem.

Here is the Javascript file in question:

  var varieties = new array (); & Lt;% Diversity for% Variation -%> & gt; Varieties Push (New Array (& lt;% = h Miscellaneous. Producer_id%>, "& lt;% = h Various .name% & gt;", & lt;% = h variety.id% & gt;) ); & Lt;% end -% & gt; Selected from function collection (e) {product_id = e.getValue (); Option = e.next (1). the option; Options.length = 1; Varieties.each (Function (Variation) {If (Miscellaneous [0] == product_id) {Option [options.length] = New option (Variation [1], Miscellaneous [2]);}}); }  

Any guidance is highly appreciated

Update

This is html ...

User / Edit.html.erb

  & lt;% javascript 'dynamic_widget'% & gt; & Lt; H2 & gt; Edit your profile & lt; / H2 & gt; & Lt;% = Render: Partial = & gt; 'Form'% & gt;  

User / _form.html ARB

  & lt;% form_for @user do | F | & Gt%; & Lt ;! - This dynamically combines a new pair of dropdowns, i.e. Product & amp; Variation - & gt; & Lt; P class = "addProduct" & gt; & Lt;% = add_season_link "+ Add another product"% & gt; & Lt; / P & gt; & Lt ;! - This is where the product & amp; Miscellaneous dropdowns are provided - & gt; & Lt; Div id = "weather" & gt; & Lt;% = Render: Partial = & gt; 'Weather',: archive = & gt; @ User.seasons% & gt; & Lt; / Div & gt; & Lt;% end% & gt;  

user / _season.html.erb

  & lt; Div class = "weather" & gt; & Lt;% new_or_existing = season.new_record? ? 'New': 'Existing'% & gt; & Lt;% prefix = "user [# {new_or_existing} _season_attributes] []"%> For the & lt;% fields_ prefix, do the Season Weather_form | -% & gt; & Lt;% = error_messages_for: Season, Object = & gt; Season% & gt; & Lt; Div class = "every market" & gt; & Lt; P class = "marketDrop" & gt; & Lt ;! - This product is a dropdown that is dependent variation dropdown - & gt; & Lt; Label = "user_product_id" & gt; Product: & lt; / Label & gt; & Lt;% = season_form.collection_select: product_id, Product.find (: all,: order = & gt; 'name') ,: id ,: name, {: prompt = & gt; "Select the product"}, {: onchange = & gt; "Selected from the collection (this);"}%> & Lt; Label = "user_variety_id" & gt; Variation: & lt; / Label & gt; & Lt ;! - This is a variation dropdown that is dependent on the product dropdown - & gt; & Lt;% varieties = Season Product? Season.product Categories: Variety.all% & gt; & Lt;% = season_form.select: variety_id, options_from_collection_for_select (varieties,: id ,: name, season.value_id), prompts = & gt; "This is optional"% & gt; & Lt; / P & gt; & Lt; / Div & gt; & Lt;% end -% & gt;  

Update # 2

I installed the firebug lights and confirmed that there is an error thrown error in IE:

< Pre> options = e.next (1). the option;

The following differences also throw the same error:
Option = $ (e) .next (1). Option - option = e.next ('select'). the option;

Any thoughts?

I think that e.next (1) will create problems < / P>

What you want, should be clearly about this, because different browsers have different ideas that are "next" in the DOM at any time.

Try e.next ('select') Maybe?

It would be easy to reply with HTML.


Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -