Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using validate on ReferenceInput #9568

Closed
Dreamsorcerer opened this issue Jan 7, 2024 · 2 comments · Fixed by #9637
Closed

Using validate on ReferenceInput #9568

Dreamsorcerer opened this issue Jan 7, 2024 · 2 comments · Fixed by #9637
Assignees

Comments

@Dreamsorcerer
Copy link
Contributor

Dreamsorcerer commented Jan 7, 2024

What you were expecting:
Setting validate=required() on ReferenceInput to make the label appear as required.

What happened instead:
I needed to set validate on AutocompleteInput instead.

Maybe it would be good to mention validate in the ReferenceInput documentation to avoid this confusion? Unless there's a code fix to ensure that validate gets passed through?

Code I used looks something like:

<ReferenceInput {...props}>
    <AutocompleteInput label={props["label"]} />
</ReferenceInput>
@fzaninotto
Copy link
Member

You're right, we should catch the validate prop in <ReferenceInput> and throw an error explaining that it should be set on the child instead. Would you mind opening a PR for that?

@d640k
Copy link

d640k commented Apr 26, 2024

This isn't caught by TypeScript as ReferenceInputProps extends InputProps which includes validate. Not sure what the implications are, but should that prop be omitted?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants