Element autocomplete does not validate against list of options

Created on 25 July 2024, 4 months ago

Problem/Motivation

I've got an autocomplete "Countries" that is given a list of options. That all works great, but if I enter some country that doesn't exist in that list, it still submits fine! I chose the 6.3.x version, but this is true of the 6.2.x version as well (which is what I'm actually using).

Steps to reproduce

1. Create a webform element using the "Autocomplete" option
2. On the front end, enter a string into the autocomplete field that does not produce a country match.
3. Submit the form and see no errors. Ideally, it would ask you to choose a valid option.

Proposed resolution

Add a `#element_validate` that checks the submission against the list of valid options. A blank option can be considered valid.

Remaining tasks

Submit an MR -- I will have one up shortly.

πŸ› Bug report
Status

Active

Version

6.3

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States mariacha1

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024