User avatar
🌤️ neocat_floof_enboy neocat_flag_pan neocat_flag_ukraine @rain@itsraining.twink.men
5d
help, i'm being forced to understand React
:neocat_cry@mk.therwi.net:1:neocat_scream_scared@social.noleron.com:1❤️2
2
0
5
4
User avatar
🌤️ neocat_floof_enboy neocat_flag_pan neocat_flag_ukraine @rain@itsraining.twink.men
5d
am i evil for making a form element which is initially an input type=text but the webpage in the background makes an api call (and due to the nature of the middleware that api call is quite slow) and when the api call completes, the element gets replaced from input to select which contains only valid values (i'm praying that the user will fill the form slowly enough for the api call to complete before they get to that form element, or if the api call fails the user wouldn't really notice that and fill the form as usual, except they would have to write out the thing manually and not select it)
2
0
1
0
User avatar
misora みそら @misora@mk.absturztau.be
5d
@rain for safety, you would have to handle the case where they submit from an input anyway. If the server rejects the invalid value, the frontend can show an error message.
Now we can consider your idea. You can check if the input has been typed in or not before swapping it to a select. If not, swap. If typed, check if valid. If valid, swap. If invalid, show error message and offer to select a valid one from the select (here you might have to show both the input containing the invalid value and the select containing valid values).
So it's possible and not too odd, but the question is it worth the effort
1
0
1
0
User avatar
🌤️ neocat_floof_enboy neocat_flag_pan neocat_flag_ukraine @rain@itsraining.twink.men
5d
@misora i decided to set disabled for input and make it say "loading..." (i think it would be prettier than a simple text and also i think that the arrow of the dropdown list appearing only after the api call finishes would be a neat way to communicate to user that they can interact with the list)
❤️1
0
0
0
1