There are two places to put form validation when developing with rails – Model class in rails or ‘required’ property in html5 on the very page. What is the best solution?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Use both. The
requiredattribute (and other client-side validation methods) provides users with validation before submitting, enabling them to fix their errors before they submit. But ultimately, you have to check all incoming data server-side as well, to be sure that you don’t save anything invalid.