I need to submit a form using TextField from vibe design. Here is my issue.
Each time i tried to submit a form, it throws error Cannot read property ‘value’ of undefined
TypeError: Cannot read property ‘value’ of undefined
** at handleChange**
Here is the code
// import goes here
const MyForm = () => {
const [inputValue, setInputValue] = useState('');
const handleChange = (event) => {
setInputValue(event.target.value);
console.log("event target value", event.target.value);
};
const handleSubmit = (event) => {
event.preventDefault();
console.log("Submitted Value:", inputValue);
// Here you can make calls to API
};
return (
<form onSubmit={handleSubmit}>
<div>
<TextField
placeholder="Testing Form"
size="medium"
title="Testing"
type="text"
value={inputValue}
onChange={handleChange}
/>
</div>
<div>
<Button kind="primary" type="submit">Submit</Button>
</div>
</form>
);
};
export default MyForm;