-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Form submitted when pressing Enter (selecting an item) #42
Comments
I'm not convinced that this is wrong. Hitting enter in inputs and submitting a form because of that is the standard browser behaviour. Do you have another inputs in the form? What do you expect to happen when you hit enter there? Maybe the form shouldn't use |
When I hit enter, I expect the same behavior as the Html select element inside a form, which is just to select the item and not submit the form. Using Small test: <!DOCTYPE html>
<head>
<meta charset="utf-8">
</head>
<body>
<form onsubmit="alert('submitted');">
<input type="text">
<select>
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="mercedes">Mercedes</option>
<option value="audi">Audi</option>
</select>
<input type="submit" />
</form>
</body> Hit enter on the field, it gets submitted. Go to the select and hit enter or change the option and the form will not be submitted. |
Make sense, thanks |
If the select is wrapped in a
Html.form
then the form is submitted whenever the user hits enter to select an item (using the keyboard)The text was updated successfully, but these errors were encountered: