Not working onChange property in select input type
Closed this issue · 5 comments
felipecock commented
The 'select' type input does not have a property to trigger an event handler when it changes.
I have tried with onChange into textInputProps, but it won't trigger because this is actually a Menu item with a onDismiss void property that has not been linked to the InputSelect props.
<FormBuilder
control={control}
setFocus={setFocus}
formConfigArray={[
{
name: 'favoriteFruit',
type: 'select',
textInputProps: {
label: 'What is you favorite fruit?',
onChange: fruit =>
console.log('Your favorite fruit is: ', fruit),
},
options: [
{
value: 'mango',
label: 'Mango',
},
{
value: 'banana',
label: 'Banana',
},
{
value: 'strawberry',
label: 'Strawberry',
},
{
value: 'pineapple',
label: 'Pineapple',
},
{value: 'other', label: 'Other'},
],
rules: {
required: {
value: true,
message: 'This field is required.',
},
},
},
]}
/>
fateh999 commented
Ok i will add a callback, for this use case
felipecock commented
felipecock commented
Ok i will add a callback, for this use case
Excellent, thank you Fateh.
felipecock commented
Hello Fateh, did you have time to take a look at my PR #32 to add this feature?
I'm really needing this urgent to fix a bug in my application. Thank you very much and have a nice weekend.
fateh999 commented
Thanks for the PR, i have merged it in the latest release v2.0.6