In ActiveAdmin I have a form with typed inputs and required fields, and even If I let required fields blank or put numbers in email typed input, I am still able to perform submit even if the form is not valid.
my code :
ActiveAdmin.register User do
actions :all, except: [:destroy, :edit]
permit_params :email
form do |f|
f.semantic_errors
f.inputs 'Invite a new user' do
f.input :email, required: true, input_html: {required: true, type: "email" }, as: :email
f.input :first_name
f.input :last_name
end
f.actions
end
This issue is due to the fact that formtastic puts "novalidate" by default on all forms :
https://github.com/formtastic/formtastic/issues/1001
The fix is to create an initializer and update default formtastic config where it make sense for you such as :