Skip to main content

Simplifying Complexity: Streamlining Web Forms with Smarter Validation

Design
Front-end Development

One of my favorite aspects of web development is simplifying complex processes into elegant, user-friendly solutions. Last week, I had the perfect opportunity to do just that. I was tasked with improving the user experience of a web form while enforcing stricter validation rules. This presented an interesting challenge, as more stringent validation often leads to more error messages, which can quickly frustrate users.

The form in question is used to select an options contract. While I won't dive into the specifics of options contracts here, you can think of them as ways to bet on the direction of a stock's price movement over a specified time horizon. Each contract has four key attributes: the stock name, the expiration date, the predicted price, and type ('calls' if we expect the stock price to increase, vs. 'puts' if we believe the stock price will fall). These attributes are encoded in a single "ticker symbol," which might look something like 'DHI241115C00170000'.

options contract symbol input as text

 

No one wants to type something that complicated—or worse, spend time verifying that it's correct after an error pops up. Rather than forcing users to type or double-check such a complex string, we decided to abstract the ticker symbol into its four simple components. This eliminated the need for tedious typing, reduced the risk of invalid entries, and spared users the frustration of checking for typos.

The real win came from leveraging an API to prevent invalid submissions altogether. Instead of asking the user to manually input the predicted price, we used the API to pull in all the valid prices matching the values they had already entered. This allowed users to simply select the correct price from a list, streamlining the process and ensuring greater accuracy.

options contract symbol input as select

Need a fresh perspective on a tough project?

Let’s talk about how RDG can help.

Contact Us