react-forms
react-forms copied to clipboard
When passing the initialValues { SELECT_OPTION : 0 } in schema then in select that value not showing as selected.
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?
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. 😸
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.
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.