Skip to content

Validating dynamically added forms

steve-v-jedo edited this page Jun 1, 2012 · 1 revision

In order to validate forms added to the page dynamically the validate function needs to be called for that form.

For example:

If you dynamically render the following rails template into you view:

<%= form_for @some_model, :validate => true, :id => 'my_dynamic_form' do |f| %>
   <%= f.text_field :some_attribute %>
<% end %>

you will need to call:

$('#my_dynamic_form').validate()

to have form validate client side.