add error messages for InventorySelect

This commit is contained in:
Keith Grant 2019-10-17 10:55:37 -07:00
parent 857683e548
commit 8e2622d117
2 changed files with 13 additions and 1 deletions

View File

@ -12,13 +12,23 @@ const getInventories = async params => InventoriesAPI.read(params);
class InventoryLookup extends React.Component {
render() {
const { value, tooltip, onChange, required, i18n } = this.props;
const {
value,
tooltip,
onChange,
required,
isValid,
helperTextInvalid,
i18n,
} = this.props;
return (
<FormGroup
label={i18n._(t`Inventory`)}
isRequired={required}
fieldId="inventory-lookup"
isValid={isValid}
helperTextInvalid={helperTextInvalid}
>
{tooltip && <FieldTooltip content={tooltip} />}
<Lookup

View File

@ -240,6 +240,8 @@ class JobTemplateForm extends Component {
form.setFieldValue('organizationId', value.organization);
this.setState({ inventory: value });
}}
isValid={!form.errors.inventory}
helperTextInvalid={form.errors.inventory}
required
/>
)}