Created this very simple code to replicate my issue. Form will not submit if input text has no value (correct). But it will submit if select input not chosen (incorrect). I'm probably missing something very basic here, but I don't know what.
Edit: Just realized this works in Firefox; but not Chrome.
Edit 2: Chrome is rendering my page with the following, instead of what I have in my code.
<option value>Select</option>
Any ideas why? It's a .razor page if that matters. But based on other research, not having the value="" is why it's not working in Chrome.
<form>
<div>
Any Text:
<input type="text" required="required" />
</div>
<div>
Country:
<select required="required">
<option value="">Select</option>
<option value="US">United States</option>
<option value="CA">Canada</option>
</select>
</div>
<div>
<button type="submit">
Test
</button>
</div>
</form>
Edit 3: I got the HTML to render correctly in Chrome with the following workaround, but the validation in Chrome still does not work:
<form>
<div>
Any Text:
<input type="text" required="required" />
</div>
<div>
Country:
<select required="required">
<option value="@blankString">Select</option>
<option value="US">United States</option>
<option value="CA">Canada</option>
</select>
</div>
<div>
<button type="submit">
Test
</button>
</div>
</form>
@code {
string blankString = "";
}
Page code source:
<select required="required">
<option value="">Select</option>
<option value="US">United States</option>
<option value="CA">Canada</option>
</select>