Topic: link_to_remote parameters


Does anyone knows how I can get values from input items and add them to the link_to_remote params?


<select name="selectbox" id="selectbox">
<option id="1">Option1</option>
<option id="2">Option2</option>
<option id="3">Option3</option>
<input type="text" name="textField" id="textFieldID" />

I use a remote_form now, but that's not possible anymore.

Nested forms does not work very well smile

Any help is highly appreciated.


Re: link_to_remote parameters

Inside any javascript you can attach this little snipped which will grab the value of anything with the right 'id':


Re: link_to_remote parameters

Or you can use the shorter method:


Re: link_to_remote parameters

Briliant ! Thanks.

Now I only have to find how I can implement that in the link_to_remote.


<%= link_to_remote "add", :url=>{ :action => :add_material_new, :index => index },:with=> "'material_name='+$F('material_name')" %>

The :with does the trick!


Last edited by NeXoPheuS (2007-01-27 08:31:51)

Re: link_to_remote parameters

Wow! You can use :with in link_to_remote? Why don't they document these things? *sigh*

Good find. That's very nice to know. I wonder what other AJAXy methods support :with and don't specify in the docs.

Railscasts - Free Ruby on Rails Screencasts