ibuck
ibuck

Reputation: 495

Rails Formtastic FormBuilder Customize Markup?

Does anyone know if there are hooks for customizing the output of formtastic?

Currently if I do something like this:

= form.input :name, :label => "Name"

It will render a list item:

<li id="item_name_input" class="string required">
    <label for="item_name">Name<abbr title="required">*</abbr></label>
    <input type="text" value="" name="item[name]" maxlength="255" id="item_name">
</li>

I want to get rid of the li wrapper (and parent ol) and replace with a div. Can't seem to find anything on the formtastic wiki about this.

Upvotes: 1

Views: 1566

Answers (2)

oldhomemovie
oldhomemovie

Reputation: 15129

Starting with this commit Formtastic supports modifying and customizing inputs. Also, consider taking a look at SimpleForm, which is less strict about markup and css.

Upvotes: 0

farnoy
farnoy

Reputation: 7776

Unless you fork formtastic and change this line, I don't think there's any way to do this. Formtastic's philosophy bases on Aaron Gustafson Presentation, which shows this ol way to code forms.

Upvotes: 2

Related Questions