Hi, I have some RJS code to update my select fields. It perfectly works on Firefox, but IE don''t want to send params to controller. Here is the code in view: <%= select("incident","service_group_id", @service_groups,{:selected => 0},{ :onchange => remote_function( :update => "incident_service_id", :url => {:action => :update_services}, :with => "''service_group_id='' + this.value") }) %> So in Firefox I have following params for ex.: {"action" => "update_services", "controller" => "incidents", "service_group_id" => "2"} But in IE: {"action" => "update_services", "controller" => "incidents"} Tested on ruby 1.8, rails 2.3.4, Firefox 3.5, Internet Explorer 6,7,8 Hope, u help me -- Posted via http://www.ruby-forum.com/.
On Tue, Oct 6, 2009 at 2:23 PM, Alexei Spirit <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > Hi, > > I have some RJS code to update my select fields. It perfectly works on > Firefox, but IE don''t want to send params to controller. > > Here is the code in view: > > <%= select("incident","service_group_id", @service_groups,{:selected => > 0},{ > :onchange => remote_function( > :update => "incident_service_id", > :url => {:action => :update_services}, > :with => "''service_group_id='' + this.value") > }) %>Are you sure that this.value is the way of access a select control current value? Probably IE access it in a different way (as usual) I''d strongly recommend you to access the value using Prototype or jQuery or whatever JS library you''re using. -- Leonardo Mateo. There''s no place like ~
When I''m doing like this: :onchange => remote_function( :update => "incident_service_id", :url => {:action => :update_services}, :with => "''service_group_id='' + alert(this.value)") IE shows write option value... I''m using Prototype. So could u show me how to access this value by Prototype library. -- Posted via http://www.ruby-forum.com/.
On Tue, Oct 6, 2009 at 2:47 PM, Alexei Spirit <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > When I''m doing like this: > :onchange => remote_function( > :update => "incident_service_id", > :url => {:action => :update_services}, > :with => "''service_group_id='' + alert(this.value)") > IE shows write option value... > > I''m using Prototype. So could u show me how to access this value by > Prototype library.I''m not using Prototype since a while ago, but I think this should work. http://api.prototypejs.org/dom/form/element.html#getvalue-class_method (API docs are your friend.) -- Leonardo Mateo. There''s no place like ~
<%= f.select("service_group_id", @service_groups,{:selected => 0},{ :onchange => remote_function( :update => "incident_service_id", :url => {:action => :update_services}, :with => "''service_group_id='' + $F(''incident_service_group_id'')") }) %> I''d tried this way, but effect is the same, IE doesn''t transfer params and FF does -- Posted via http://www.ruby-forum.com/.
On Tue, Oct 6, 2009 at 3:22 PM, Alexei Spirit <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > <%= f.select("service_group_id", @service_groups,{:selected => 0},{ > :onchange => remote_function( > :update => "incident_service_id", > :url => {:action => :update_services}, > :with => "''service_group_id='' + $F(''incident_service_group_id'')") > }) %> > > I''d tried this way, but effect is the same, IE doesn''t transfer params > and FF doesDid you try teh getValue() method? try this: :with => "''service_group_id='' + $(''incident_service_group_id'').getValue()) -- Leonardo Mateo. There''s no place like ~
It seems to me the promlem is not in JS, cause I can get select value from page by any method. In my opinion the problem in transfer ":with => " value in IE -- Posted via http://www.ruby-forum.com/.
Could it be concerned with session & cookies? I noticed that, when I switch authorization off, onchange event works even in IE -- Posted via http://www.ruby-forum.com/.
Here is the auth system: --------------------------------------------------------------- class ApplicationController < ActionController::Base helper :all include NtlmSystem private ... def user_required if !logged_in? redirect_to(''/login'') end end def logged_in? if session[:logged_in].nil? || session[:logged_in] == :false return false end return true end ... end --------------------------------------------------------------- class UsersController < ApplicationController before_filter :user_required, :except => :login def login samaccountname = request.env[''REMOTE_USER''] cookies[:session] = session if samaccountname.nil? session[:logged_in] = :false render :file => "#{RAILS_ROOT}/public/403.html", :layout => false, :status => 403 return end samaccountname.sub!(/OU\\/,"") @user = User.find(:first,:conditions => ["samaccountname = ?",samaccountname]) if @user.nil? session[:logged_in] = :false render :file => "#{RAILS_ROOT}/public/403.html", :layout => false, :status => 403 return end session[:current_user] = samaccountname session[:user_id] = @user.id session[:logged_in] = :true redirect_to session[:http_referer] end ... end --------------------------------------------------------------- For NTLM authentication Mongrel_NTLM plugin used Could it be problem here? -- Posted via http://www.ruby-forum.com/.