logo
podcast Podcast
get help Get Unstuck

Make forms less frustrating for your users

Show them you care

Joel Clermont
Joel Clermont
2025-05-15

Earlier this year, I talked about why we validate maximum length on form request fields that will be saved to the database.

This is great for avoiding database exceptions or truncated data, but can we go a step further and make this even better?

A simple improvement is to also use the maxlength attribute on the HTML input element.

This will prevent the user from entering more characters than the maximum length, only to get a validation error when submitting.

Of course, on its own maxlength is not sufficient, but it's a nice additional UX improvement on top of the enforced server-side validation logic.

Here to help,

Joel

P.S. The Mastering Laravel Validation Rules book is a great resource for better leveraging the power of validation to write more reliable Laravel apps.

Toss a coin in the jar if you found this helpful.
Want a tip like this in your inbox every weekday? Sign up below 👇🏼
email
No spam. Only real-world advice you can use.