3
http://localhost:3000/users?utf8=%E2%9C%93&search=aen

Here's my form in the view:

<% form_tag users_path, :method => 'get', :html => { :class => 'ui-form' } do %>
    <div class="ui-input ui-input-search">
      <%= text_field_tag :search %>
    </div>
  <% end %>

Which generates a hidden field that gets submitted:

<div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓"></div>
Bohdan
  • 8,298
  • 6
  • 41
  • 51
Aen Tan
  • 3,305
  • 6
  • 32
  • 52
  • 1
    look at his question http://stackoverflow.com/questions/3222013/what-is-the-snowman-param-in-rails-3-forms-for/3348524#3348524 – Naren Sisodiya Apr 23 '11 at 07:20

4 Answers4

6

Set the disabled attribute on the field you don't want to submit.

Or is the real question about how to get rails to not create that hidden field in the first place?

Boris Zbarsky
  • 34,758
  • 5
  • 52
  • 55
0

This can be done with JS if you use form.serialize() remove unnecessary part of parameters and make a new get request with new params

Bohdan
  • 8,298
  • 6
  • 41
  • 51
0

You can try doing something like this in an onsubmit function:

document.getElementsByName('utf8')[0].disabled = "disabled";

to prevent it from being sent.

typeof
  • 5,812
  • 2
  • 15
  • 19
0

Here's a jquery snippet - add it to your layout to disable the utf8 field in all GET forms

:javascript
      $('form[method=get] input[name=utf8]').attr("disabled", "disabled");
Mark Swardstrom
  • 17,217
  • 6
  • 62
  • 70