Forum: Ruby on Rails Firefox java script error in prototype.js

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
73e5f7ab8caf1c742b0339d695382eae?d=identicon&s=25 unknown (Guest)
on 2006-02-14 15:13
(Received via mailing list)
Hi,

I am usign two selects, a master and a slave:

<%= select("master", "id", @master) %>
<div id="slave_id_list">
<%= select("slave", "id", @slave) %>
</div>
<%= observe_field("master[id]",
  :frequency => 0.25,
  :update => "slave_id_list",
  :url => {:action => :update_slave_select},
  :with => "'my_id='+value")
%>

also I made:

def index
  @master = ...
  @slave= ...
end

def update_slave_select
  @slave= ....
  render(:partial => 'select')
end

and in _select.rhtml:

<%= select("slave", "id", @slave) %>


This works fine in internet explorer, in firefox I have the following
javascript
error:


Error: element has no properties
Source File: http://localhost:3000/javascripts/prototype.js
Line: 1280

and the javascript code at prototype:

Form.Element = {
  serialize: function(element) {
    element = $(element);
    var method = element.tagName.toLowerCase();
    var parameter = Form.Element.Serializers[method](element);

    if (parameter) {
      var key = encodeURIComponent(parameter[0]);
      if (key.length == 0) return;

      if (parameter[1].constructor != Array)
        parameter[1] = [parameter[1]];

      return parameter[1].map(function(value) {
        return key + '=' + encodeURIComponent(value);
      }).join('&');
    }
  },

  getValue: function(element) {
    element = $(element);
>>>>>>>>>>    var method = element.tagName.toLowerCase();
    var parameter = Form.Element.Serializers[method](element);

    if (parameter)
      return parameter[1];
  }
}


Any sugestion for solving this?

Thanks,

Paulo Abreu
C64e63b70be7dfed8b0742540b8b27e5?d=identicon&s=25 Mark Reginald James (Guest)
on 2006-02-14 20:37
(Received via mailing list)
paulo@explicadores.net wrote:

> <%= observe_field("master[id]",
> ...
> This works fine in internet explorer, in firefox I have the following javascript
> error:
> ...
> Error: element has no properties

Try
	<%= observe_field("master_id",


--
We develop, watch us RoR, in numbers too big to ignore.
This topic is locked and can not be replied to.