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

When passing the initialValues { SELECT_OPTION : 0 } in schema then in select that value not showing as selected. #1433

Open
anjalikalsariya opened this issue Jan 4, 2024 · 3 comments
Labels
ANT bug Something isn't working

Comments

@anjalikalsariya
Copy link

anjalikalsariya commented Jan 4, 2024

Select field

{
   "name": "SELECT_OPTION",
   "label": "test",
   "options": [
     { "label": "none", "value": 0 },
     { "label": "2", "value": 2 },
   ],
   "component": "select"
 },
Note:  I'm using the ant-component-mapper.

Can you help me for it?

@rvsia
Copy link
Contributor

rvsia commented Jan 4, 2024

This is because javascript resolves 0 as false so the select thinks there is no value. @Hyperkid123 we could probably fix it. As a workaround, @anjalikalsariya, use string and then convert it to a number. 😸

@rvsia rvsia added bug Something isn't working ANT labels Jan 4, 2024
@anjalikalsariya
Copy link
Author

Correct @rvsia. I got it.
For now, let me add that convert solution. Later, If anything will be changing in the library to fix this issue that will be more helpful.

@anjalikalsariya
Copy link
Author

One more thing is when the value is 0 and validation is required then also throws an error for an empty field. Validation does not work with the value 0 integer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ANT bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants