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

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -