I posted an answer on StackOverflow but will repost here. Antonio, maybe you can explain why "input_field" doesn't wrap the field in a <div>. The simple_form wiki refers to rdoc for info on input_field, but I couldn't find it in the rdoc.
I think there are a couple issues here. One is the formatting, and the way simple_form adds a <div> around the input field. @Ron's suggestion of using input_field
works for me with simple_form 2.0.1. My example is searching for name
in a Contacts table. The following makes the text box and button appear
side by side:
The other issue is that it seems simple_form usually assumes you want
to work with model and field names. The example above uses a :symbol instead of a @model as the first argument as suggested here. But that still generates an input field named contact[search]" so you'd have to tell your controller how to deal with that.
The f.input call does use SimpleForm stack, which will create a wrapper div and be styled as twitter bootstrap expects. But f.submit has nothing to do with SimpleForm, it's a bare Rails method, and does not create any extra markup. SimpleForm cannot guess the final markup you want, it just has some defaults and you have to customize them if you want to go further.
The problem is the final markup you want. If you want a simple markup, in this case, just ignore SimpleForm and go straight to Rails' form_for and f.text_field helpers.
On Monday, April 23, 2012 at 5:26 PM, Abram Bailey wrote: