# Problem with RJS, params and Internet Explorer

**URL:** <https://www.ruby-forum.com/t/problem-with-rjs-params-and-internet-explorer/176808>\
**Category:** Rails\
**Created:** [October 6, 2009, 2:23pm UTC](https://www.ruby-forum.com/t/problem-with-rjs-params-and-internet-explorer/176808 "2009-10-06T14:23:29Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![alexeispirit](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/db5fbb/32.png) [@alexeispirit](https://www.ruby-forum.com/u/alexeispirit)\
**Post date:** [October 6, 2009, 2:23pm UTC](https://www.ruby-forum.com/t/problem-with-rjs-params-and-internet-explorer/176808/1 "2009-10-06T14:23:29Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![alexeispirit](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/db5fbb/32.png) [@alexeispirit](https://www.ruby-forum.com/u/alexeispirit)\
**Post date:** [October 6, 2009, 2:38pm UTC](https://www.ruby-forum.com/t/problem-with-rjs-params-and-internet-explorer/176808/2 "2009-10-06T14:38:59Z")

</div>

On Tue, Oct 6, 2009 at 2:23 PM, Alexei Spirit  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> :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 M..  
There’s no place like ~

---

<div class="post-metadata">

**Author:** ![alexeispirit](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/db5fbb/32.png) [@alexeispirit](https://www.ruby-forum.com/u/alexeispirit)\
**Post date:** [October 6, 2009, 2:47pm UTC](https://www.ruby-forum.com/t/problem-with-rjs-params-and-internet-explorer/176808/3 "2009-10-06T14:47:17Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![alexeispirit](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/db5fbb/32.png) [@alexeispirit](https://www.ruby-forum.com/u/alexeispirit)\
**Post date:** [October 6, 2009, 3:03pm UTC](https://www.ruby-forum.com/t/problem-with-rjs-params-and-internet-explorer/176808/4 "2009-10-06T15:03:00Z")

</div>

On Tue, Oct 6, 2009 at 2:47 PM, Alexei Spirit  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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](http://api.prototypejs.org/dom/form/element.html#getvalue-class_method)  
> (API docs are your friend.)

–  
Leonardo M..  
There’s no place like ~

---

<div class="post-metadata">

**Author:** ![alexeispirit](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/db5fbb/32.png) [@alexeispirit](https://www.ruby-forum.com/u/alexeispirit)\
**Post date:** [October 6, 2009, 3:22pm UTC](https://www.ruby-forum.com/t/problem-with-rjs-params-and-internet-explorer/176808/5 "2009-10-06T15:22:21Z")

</div>

\<%= 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

---

<div class="post-metadata">

**Author:** ![alexeispirit](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/db5fbb/32.png) [@alexeispirit](https://www.ruby-forum.com/u/alexeispirit)\
**Post date:** [October 6, 2009, 3:34pm UTC](https://www.ruby-forum.com/t/problem-with-rjs-params-and-internet-explorer/176808/6 "2009-10-06T15:34:37Z")

</div>

On Tue, Oct 6, 2009 at 3:22 PM, Alexei Spirit  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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 does  
> Did you try teh getValue() method?  
> try this:  
> :with =\> "‘service\_group\_id=’ +  
> $(‘incident\_service\_group\_id’).getValue())

–  
Leonardo M..  
There’s no place like ~

---

<div class="post-metadata">

**Author:** ![alexeispirit](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/db5fbb/32.png) [@alexeispirit](https://www.ruby-forum.com/u/alexeispirit)\
**Post date:** [October 6, 2009, 4:30pm UTC](https://www.ruby-forum.com/t/problem-with-rjs-params-and-internet-explorer/176808/7 "2009-10-06T16:30:45Z")

</div>

Could it be concerned with session & cookies? I noticed that, when I  
switch authorization off, onchange event works even in IE

---

<div class="post-metadata">

**Author:** ![alexeispirit](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/db5fbb/32.png) [@alexeispirit](https://www.ruby-forum.com/u/alexeispirit)\
**Post date:** [October 6, 2009, 4:05pm UTC](https://www.ruby-forum.com/t/problem-with-rjs-params-and-internet-explorer/176808/8 "2009-10-06T16:05:16Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![alexeispirit](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/db5fbb/32.png) [@alexeispirit](https://www.ruby-forum.com/u/alexeispirit)\
**Post date:** [October 7, 2009, 5:55am UTC](https://www.ruby-forum.com/t/problem-with-rjs-params-and-internet-explorer/176808/9 "2009-10-07T05:55:07Z")

</div>

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?
