Link_to to change input value

hi,

<%= text_field_tag :search_id, params[:search_id], :id=>“search_id” %>

how would I make a link_to with an :onclick to change the input field
with id=“search_id”?

Thanks!

it can be done by just some simple javascript tricks like
$(‘search_id’).value=‘whatever you want to change the input field to’
and write
<%=link_to “name”,"#",:onclick=>"$(‘search_id’).value=‘whatever you want
to
change the input field to’"%>
2008/8/6 Justin To [email protected]

Or better with inline RJS:

<%= link_to_function “Click me” do |page|
page[‘search_id’].value = ‘somethingnew’;
end %>

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs