I am trying to get validation to return in my modal using rails 3.2,twitter/bootstrap and formtastic, but I am at a loss as to how to do this.
Below is a quick sample of what my modal and form look like. In the model I require firstname and lastname. If the user hits 'submit' without putting in a firstname or lastname, it immediately takes the user to my actual registration page and notifies them of what is missing.
But I would like it to return to this modal and let the user know what is missing. How do I accomplish this?
:In my header, this is how I bring up the modal:
=link_to 'Register', "#new_registration_modal", :data => { :toggle => "modal",:backdrop => "static" }
#app/views/subscribers/registration/_new_modal.html.haml
#new_registration_modal.modal.hide.fade
.modal-header
Some Text
.modal-body
Some Text
=semantic_form_for(:subscriber, :as => resource_name, :url => registration_path(resource_name),:html => { :class => "form-inline" } ) do |f|
=f.input :email
=f.input :firstname
=f.input :lastname
=f.input :password
=f.input :password_confirmation
=f.submit
.modal-footer
Some Text