Interactive card details form

Solution retrospective
One specific challenge I faced during this project involved the expiry month (MM) input field. Instead of using a <select> dropdown for users to choose a month, I opted for a text <input> field to allow direct input. However, this introduced the following problem:
-
Challenge:
I wanted to restrict the user from entering values greater than12in theMMfield. While it was straightforward to validate the input after submission or update the value dynamically, I couldn't prevent the user from typing invalid values (e.g.,13,25) directly into the field in real-time. -
Impact:
This limitation negatively affects the user experience (UX) since users might input incorrect values and only receive feedback after submission or when focusing out of the field. Ideally, the input should restrict invalid values as they are being typed. -
Request for Help:
If you have suggestions or know a better way to implement real-time validation for numeric input fields without relying on<select>elements, I’d appreciate your input! The goal is to maintain a seamless UX while ensuring valid inputs.
Please log in to post a comment
Log in with GitHubCommunity feedback
No feedback yet. Be the first to give feedback on BartoszMokrzycki's solution.
Join our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord