I would simply like to validate the data on onChange
. Here I have tried using rules
prop from Controller
but It validate data onSubmit
. How can I call my position
method every time there’s a change in this combobox field?
<Controller
control={control}
name={`${id}_${item.item_id}`}
rules={{
validate: {
positive: (data) => {
console.log(data);
return false;
},
},
}}
render={({ field }) => {
return (
<EuiComboBox
options={itemsOptions}
placeholder="Select Item"
isClearable={true}
singleSelection={true}
selectedOptions={field.value}
onChange={field.onChange}
/>
);
}}
/>;