React-admin: Cannot perform validation on ReferenceInput values

Created on 23 Jan 2017  路  3Comments  路  Source: marmelab/react-admin

I've tried applying a validation on a <ReferenceInput/> to be required as so:

const validator = (value, values) => {
    if (!value)
        return ['Required field'];
}

<ReferenceInput source="resellerId" reference="reseller" allowEmpty={true} validation={validator}>
    <AutocompleteInput optionText="name" optionValue="id"/>
</ReferenceInput>

The value is undefined but the validation doesn't apply, although other inputs do (I tried also a global validation which did not work):
image

bug

All 3 comments

@fzaninotto Just making sure you did not miss this issue. Thanks!

I'm well aware of this, don't worry 馃槣

Fixed by #289

Was this page helpful?
0 / 5 - 0 ratings