我正在使用 react-material-ui-form-validator 中的 TextValidator ,我想要显示的是'*'在其输入标签中要求时输入。但是,通过要求为“ true”是通过浏览器验证,而不是通过验证器。 因此,一种方法是通过将“ *”附加为“标签名称*”来更新标签。这意味着对于每个元素,我都会更改标签文本。 但是,我想知道可以通过必需但使用验证器而不是浏览器验证的任何选项吗?
可编辑的CodeSandbox,如果您有解决方案,请在此处进行更新。
答案 0 :(得分:1)
react-material-ui-form-validator
使用源代码react-form-validator-core
来生成其形式。
并检查此line会显示您传递给source
.map {
sendCommand(constructCommand(_))
}
.runWith(Sink.ignore)
的所有道具({{1},ValidatorForm
,onSubmit
,instantValidate
和{ {1}})向下传递到onError
元素。
这意味着您可以使用debounceTime
属性来禁用浏览器的验证。
children