使用基础数据Abide Modal(AJAX)中的验证不会验证。 `

时间:2014-05-19 16:44:09

标签: ruby-on-rails ajax validation zurb-foundation

我无法让Data Abide在模态中验证我的字段(Foundation 5,Simple Form,Ruby on Rails)。

任何人都知道如何使用基于数据的基础使用AJAX验证模式中的字段?

<%= simple_form_for [current_user, @photo, @tag], id: "tagform", :remote => true do |f| %>
    <div class="center semi_padding new_tag_form">
      <%= f.input :name , label: "Marca: ", :required => "[a-zA-Z]+" ,input_html: {class: 'marca ipt'} %>
      <%= f.input :location, label: "¿Donde lo encontraste?" , input_html: {class: 'ipt'} %>
      <%= f.input :price, label: "¿Cuanto te costó?" , input_html: {class: 'ipt'} %>
      <%= f.input :coordinate_x , as: :hidden %>
      <%= f.input :coordinate_y , as: :hidden %>
      <%= f.button :button, "Taggear", type: "button", id:"tp_tag_save", input_html: {class: 'btn-ok icon-favorite-1 button'} %>
      <%= f.button :button, "Cancelar", name: "Cancel", id: "tp_tag_cancel", input_html: {class: 'icon-cancel button'} %>
    </div>
<% end %>

1 个答案:

答案 0 :(得分:0)

将此添加到simple_form标记:

html: {novalidate: "novalidate", data: {abide: ''}

EX:

<%= simple_form_for [current_user, @photo, @tag], id: "tagform", :remote => true, html: {novalidate: "novalidate", data: {abide: ''} do |f| %>

然后确保在通过将以下JS添加到click处理程序触发模式时在表单上引入reflow调用:

$(document).foundation('abide', 'reflow');