2

I'm using

<%= text_field 'person', 'one',:id => 'test', :onchange=>remote_function(:url=>{:action=>"update"}, :update=>"test") %>
<div id="test"></div>

Now I just want to send the value of text_field with :action i.e :url=>{:action=>"update(value_of_text_field_entered"}

Don't want to use params[:person][:one].

Any suggestions?or how can I use <%= observe_field %> to send the value with action?

sgi
  • 2,032
  • 6
  • 21
  • 28

3 Answers3

2

You can try this one also:
<%= text_field 'person', 'one' %>


### Paste following code in your javascript

$("#person_one").live("change", function(){
  $.ajax({
    complete:function(request){},
    data:'person_one='+ $(this).val(),
    dataType:'script',
    type:'get',
    url: '/update'route
  })
});


Nimesh Nikum
  • 1,809
  • 13
  • 17
1

Use

<%= text_field 'person', 'one',:id => 'test' %>

<%= observe_field 'persone_one', 
     :url=>{:action=>"update"} ,
 :frequency => 0.25,
     :update=>'test',
     :with => 'person_one'
     %>

<div id="test"></div>

you get value of textfiled in params[:person_one]

Salil
  • 46,566
  • 21
  • 122
  • 156
1

maybe you can use a javascript code, "this.value()"

Mehmet Davut
  • 667
  • 10
  • 30