Skip to content

Opinion on validation #148

Answered by tomickigrzegorz
kilianso asked this question in Q&A
Discussion options

You must be logged in to vote

Hi,
Probably the simplest approach that you can think of quickly.
A variable that is initially set to false, when someone writes it, it is always false.
When you select it from the list, you change it to true and only then you can submit the form using the button.
When someone wants to enter their own city and send the form, you give info that they can only choose a city from the list.
Only selecting a city from the list changes the value to true.

Another approach https://tomik23.github.io/autocomplete/#select-item
Selecting an element and putting it into input which is set to readonly and giving it the option to do submit.

Good luck

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@kilianso
Comment options

Answer selected by kilianso
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants