Autocomplete combobox validation #3797
-
If a user has started typing into an autocomplete combobox but has not selected anything, is it a best practice to "clear" that field when they submit the form, or provide an inline validation error prompting them to select an option? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Disclaimer: This is a very experimental bot using OpenAI's GPT-4. The answers may not be correct, a human will review the answer and update it if necessary. Based on the provided documentation, it's not explicitly stated whether to "clear" the field or provide an inline validation error for an autocomplete combobox when a user submits a form without selecting an option. However, the documentation does emphasize the importance of validation and providing error messages to explain what information is missing or incorrect. Given this guidance, it would be more aligned with best practices to provide an inline validation error prompting the user to select an option from the autocomplete combobox rather than clearing the field. This approach helps ensure that users are aware of the mistake and understand how to correct it, which is crucial for a good user experience and accessibility. Here's a snippet related to validation from the documentation:
For more details on implementing validation and error handling with the Combobox component, you can refer to the Paste design system documentation: Combobox - Paste I also did a search, and I managed to find these other Discussions that might be similar or related to your question. Give them a read to see if they answer your question. If they do, head back here and update this discussion and mark it as answered, pointing others to the related discussion:
|
Beta Was this translation helpful? Give feedback.
-
^ what Paste Bot said, but also—without knowing what the intention of the user was (whether they didn't intend to type anything or just forgot to select an option they typed), you might want to go with the safer choice anyway, which is leaving their input and providing an error. |
Beta Was this translation helpful? Give feedback.
^ what Paste Bot said, but also—without knowing what the intention of the user was (whether they didn't intend to type anything or just forgot to select an option they typed), you might want to go with the safer choice anyway, which is leaving their input and providing an error.