I’ve got a select dropdown in a form using React and Bootstrap, and I’d like to require the select element to submit the form. However, I can’t seem to find anything on this in the react-select docs, and it seems to still be an open issue based on GitHub. I figured I could simply add the “required” attribute to the element like in vanilla HTML, but it doesn’t work.
For the meantime, I’ve followed others’ lead on GitHub by adding an invisible input element below the select element, made it required, passed the select element’s value in as a prop to the input value, and used CSS to make the “required” popup appear directly over the target select element when the user tries to submit without filling it in.
I’ve already checked out the following links and other similar pages (some of which I’ve followed for the above approach), but I’m wondering… is there an easier way that I’m just not seeing??