mirror of
https://github.com/apache/superset.git
synced 2026-04-14 05:34:38 +00:00
[explorev2] Fields can validate input and handle errors (#1980)
As a result here, TextField does its own validation and now casts the values it sends to Int or Float if set to do so.
This commit is contained in:
committed by
GitHub
parent
99b84d2909
commit
a96024d0e7
@@ -42,8 +42,11 @@ export default class FieldSet extends React.PureComponent {
|
||||
this.validate = this.validate.bind(this);
|
||||
this.onChange = this.onChange.bind(this);
|
||||
}
|
||||
onChange(value) {
|
||||
const validationErrors = this.validate(value);
|
||||
onChange(value, errors) {
|
||||
let validationErrors = this.validate(value);
|
||||
if (errors && errors.length > 0) {
|
||||
validationErrors = validationErrors.concat(errors);
|
||||
}
|
||||
this.props.actions.setFieldValue(this.props.name, value, validationErrors);
|
||||
}
|
||||
validate(value) {
|
||||
|
||||
Reference in New Issue
Block a user