ruby on rails - How to add data-attribute to the form tag in simple_form? -
i'm using garlic.js validate forms. garlic.js recommends adding data-attribute on form tag.
here's need generate:
<form data-validate="parsley">
i'm having issues generate data attribute on form tag. tried , nothing worked. has solution this?
try this:
<%= simple_form_for @entity, :html => {:"data-validate" => 'parsley'} |f| %> <!-- inputs --> <% end %>
update
from comment below, have form include html5 data attribute no value try following:
<%= simple_form_for @entity, :html => {:"other-data-value" => ''} |f| %>
by setting attribute empty string form helper renders attribute.
Comments
Post a Comment