“Invalid form control” only in Google Chrome

前端 未结 13 1660
感情败类
感情败类 2020-11-29 03:32

The code below works well in Safari but in Chrome and Firefox the form will not submit. Chrome console logs the error An invalid form control with name=\'\' is not fo

13条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-11-29 04:33

    I was getting this error, and determined it was actually on a field that was not hidden.

    In this case, it was a type="number" field, that is required. When no value has ever been entered into this field, the error message is shown in the console, and the form is not submitted. Entering a value, and then removing it means that the validation error is shown as expected.

    I believe this is a bug in Chrome: my workaround for now was to come up with an initial/default value.

提交回复
热议问题