Stress less with form validations. The importance of data accuracy.

Mary Ann Navarrete
4 min readFeb 23, 2021

--

The moment I learned about validations while learning Ruby on Rails, I “reminisced” about the good-ole days when I worked in hotel sales, and dealt with the data from our sales CRM software. I didn’t have bad habits as a sales manager per se, typically filling out contact information, event booking details and leads as completely as I could. However, it wasn’t until I became a Director of Sales and had to pull, analyze and report out on the entire sales team’s data, that I realized the importance of completion and consistency in formatting. Oh validations, where were you in my past life?!

Data is vital in every industry. If data isn’t accurate or complete from the start, the results won’t be accurate either. In hotel sales, we’d use data to query a list of accounts and customers to generate prospecting lists. We’d use it to report how much activity the sales team was completing on a regular basis, how much revenue was made, lost, how many leads went to the competition, how many leads converted to actual business, how much revenue was booked compared to prior year. You name a metric, I was asked to compile data for it.

The biggest issue was, that not everyone was on the same page when it came to data input etiquette. Missing dates, missing phone numbers, missing booking statuses, lowercase cities, spelled out vs. abbreviated states. It was a cause of many migraines I had those years!

Unfortunately, that particular software, didn’t exactly have all the necessary validations needed at the time. As much as you try to establish rules with team members on the proper ways of inputting their contacts and leads, (yes… I actually made cheat sheets and audit checklists that had “select booking status, capitalize first letter in name, enter VA instead of Virginia”), 100% completion was hard to come by. Especially when someone was dealing with an abundance of leads, being lazy, rushing through, or forgetting, it can be missed enough times to make significant impacts on results.

Well, what if we took that control away from someone? What if, in order to submit the data, they can’t move on unless they enter what you require or have it in the format requested? This would save significant time in analyzing data for missing revenue, accuracy and so much more.

Validation Examples

Below are a few ways to include validations in forms using Ruby on Rails.

Require first name, last name and email to be present.

Ensure that email entered is unique.

Require phone number to be 10 characters long .

Require a password to be between 8–20 characters long

Requiring that a description is a minimum of 100 characters

Comment cannot have more than 500 characters

Requires name of lead, if user marks true on ‘has_lead’

There are many more validation methods out there, such as date validations, custom validations, and more advanced usage and methods. However, the above validations are a good start! At the very least, our data will no longer be missing names and emails. You’re welcome!

“Complete data means happy people!” — pretty sure someone’s quoted this before.

For more on validations, check out the Ruby on Rails documentation. https://guides.rubyonrails.org/active_record_validations.html

--

--

Mary Ann Navarrete

Hospitality Sales turned Software Engineer. I love building things, solving problems and analyzing complex data. Tales of my journey with a mix of positivity.