Textbox input for an action: failed attempt

Okay, so this is what I have (which fails miserably) in my view:

Please enter a username: <%= form_remote_tag :html => { :update => "filter_counts",   :url => {:action => "search_by_name"} }do -%> <div><%= text_field_tag 'username', :maxlength => 15, :size => 12 %></div> <div><%= submit_tag 'Search' %></div>   <% end -%>

"filter_counts" is a div, "search_by_name" is the action, I think the rest makes sense.

And here is my error:

compile error C:/scripts/Rads/app/views/dictated_exams/index.html.erb:5: syntax error, unexpected ')'   :url => {:action => "search_by_name"} }do ).to_s)                                              ^ C:/scripts/Rads/app/views/dictated_exams/index.html.erb:36: syntax error, unexpected kENSURE, expecting ')' C:/scripts/Rads/app/views/dictated_exams/index.html.erb:38: syntax error, unexpected kEND, expecting ')'

Extracted source (around line #5):

2: <center> 3: Please enter part of a name ('%' is the wild card character): 4: <%= form_remote_tag :html => { :update => "filter_counts", 5: :url => {:action => "search_by_name"} }do -%> 6: <div><%= text_field_tag 'username', :maxlength => 15, :size => 12 %></div> 7: <div><%= submit_tag 'Search' %></div> 8: <% end -%>

I don't know how much this helps, but I've learned the hard way that, when I write

<%= blah :blah, :blah do |x| %> <% end %>

I get bizarre (and always incorrect) results.

The reason is that <%= ... %> results in a string that gets inserted into your HTML stream, while <% ... %> results in some Ruby code that gets executed with no output going to the HTML stream. If the Ruby code includes a block, then, presumably, that block will output the HTML stuff you were hoping to output.

--wpd