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’"%>

Or better with inline RJS:

<%= link_to_function "Click me" do |page|
               page['search_id'].value = 'somethingnew';
          end %>