Hello
I'm struggling to pinpoint my issue with UI Kit Form component that I use in Confluence macro.
I have a simple Form with a single select field, but for some reason the formData is undefined when I submit the form:
import React, { Fragment } from "react";
import ForgeReconciler, {
Form,
Select,
Text,
FormFooter,
Button
} from "@forge/react";
const App = () => {
const onSubmit = (formData) => {
console.log('formData: ', formData);
};
return (
<Fragment>
<Form onSubmit={onSubmit}>
<Text>Hello</Text>
<Select
name="Numbers"
options={[{label: '1', value: '1'}, {label: '2', value: '2'}, {label: '3', value: '3'}]}
/>
<FormFooter align="start">
<Button type="submit">Submit</Button>
</FormFooter>
</Form>
</Fragment>
);
};
ForgeReconciler.render(
<React.StrictMode>
<App />
</React.StrictMode>,
);
I was missing the useForm hook import: https://developer.atlassian.com/platform/forge/ui-kit/hooks/use-form/
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.