-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
[BUG] - Add validationBehavior
support for Select
#3913
Comments
Can you share the exact code of those components shown in the screenshot? A sandbox would be better. |
Sorry I couldn't figure out how to work with a Sandbox lol... My code is more or less like below:
Then when the form is submitting with empty data in However, if the Hope I made myself clear lol |
Try this. <Input isRquired validationBehavior="native" /> @wingkwong // use-input.ts line 363
const getInputProps: PropGetter = useCallback(
(props = {}) => {
return {
ref: domRef,
//...
};
//....
},
[
//...
],
); |
Thanks for the reply. But I prefer to disable the native validation behaviour for As I found out, And setting |
@jijiseong the original ref is passed to |
would you assign to me? |
@jijiseong assigned. thanks. |
@wingkwong What should i do to achieve the reverse of this issue, i.e disable the build in html validation from select. For the above screenshot i used |
@wingkwong const getInputProps: PropGetter = useCallback(
(props = {}) => {
return {
ref: originalProps.ref,
//...
};
//....
},
[
//...
],
); |
React Aria prevents browser error UI from appearing, but https://github.com/adobe/react-spectrum/blob/93c26d8bd2dfe48a815f08c58925a977b94d6fdd/packages/%40react-aria/form/src/useFormValidation.ts#L70-L71 |
I found that in order to enable the Input to have the default HTML required validation I just need to add When using select with <input tabindex="-1" required type="text" value="" style="font-size: 16px;"> I would expect the Input component to also add the |
Select is implemented by customizing react-aria, so we haven't been able to incorporate validationBehavior yet. |
validationBehavior
support for Select
NextUI Version
2.4.8
Describe the bug
Input
andSelect
validation behaviour is different.Your Example Website or App
No response
Steps to Reproduce the Bug or Issue
When I set
isRequired
on bothInput
&Select
, the select dropdown uses HTML built-in validation. However, the input box doesn't.From the screenshots below, you can see the validation error pops up for
Select
, but not forInput
Expected behavior
They should behave in the same way.
Screenshots or Videos
Operating System Version
Mac
Browser
Chrome
The text was updated successfully, but these errors were encountered: