Does anyone know if there are hooks for custom开发者_JS百科izing 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.
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.
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.
精彩评论