antd form.item

I have a form with 4 form items but i just want to post 3 items to table in hasura while submitting a form
G
genetic-orange505d ago
Hi @rehan1, great to see you again 🙏 can you change data before submit ? you can filter out anything you want https://refine.dev/docs/faq/#how-can-i-change-the-form-data-before-submitting-it-to-the-api
FAQ | refine
How can I change the form data before submitting it to the API?
Q
quickest-silver505d ago
but iam using it in useModalForm how to pass that in okButtonProps
G
genetic-orange505d ago
i will try to implement on useModalForm, please wait 🙏 can you follow this example snippet ? on form, u can ovveride onFinish() and manipluate returned data. after that u can call formProps.onFinish() with that data.
<Modal {...modalProps}>
<Form {...formProps}
onFinish={(values) => {
const { name, surname } = values;
const fullName = `${name} ${surname}`;

return (
formProps.onFinish &&
formProps.onFinish({
...values,
fullName,
})
);
}}
layout="vertical">
<Form.Item label="Title" name="title">
<Input />
</Form.Item>
<Form.Item label="Status" name="status">
<Radio.Group>
<Radio value="draft">Draft</Radio>
<Radio value="published">Published</Radio>
<Radio value="rejected">Rejected</Radio>
</Radio.Group>
</Form.Item>
</Form>
</Modal>
<Modal {...modalProps}>
<Form {...formProps}
onFinish={(values) => {
const { name, surname } = values;
const fullName = `${name} ${surname}`;

return (
formProps.onFinish &&
formProps.onFinish({
...values,
fullName,
})
);
}}
layout="vertical">
<Form.Item label="Title" name="title">
<Input />
</Form.Item>
<Form.Item label="Status" name="status">
<Radio.Group>
<Radio value="draft">Draft</Radio>
<Radio value="published">Published</Radio>
<Radio value="rejected">Rejected</Radio>
</Radio.Group>
</Form.Item>
</Form>
</Modal>
Q
quickest-silver504d ago
but i want to show formitem based on previous formitem which is select dropdown get selected? it worked thank u
G
genetic-orange504d ago
Hi @rehan1 , sorry for late response. I'm glad to hear that 🙏
More Posts
Why warnWhenUnsavedChanges show when I shift to different tabs?I need help. I have a big form which compose of tabs to make it more user friendly. My issues: WhUncaught TypeError date.locale is not a functionI am using ant design `TimePicker` component on my form. While creating a form it doesn't have a proIs there a way to submit a Timepicker form value as a string?I am using ant design `TimePicker` component and when I submit the form the submitted data is an dayuse router v6 with search paramsHello 👋 i am trying to programmatically redirect to the create view of a resource and passing sooperators for crudFilters- contains v. containssIs there a difference between 'contains' v. 'containss'Using react-router-dom hooksI want to use react-router-dom hooks but I get: `useLocation() may be used only in the context of a duplicate value i dont want to posti am having a form and i posting name . so i dont i want to post duplicate name another time . it shCan I display a list of posts within a category?In this format: `categories/1/posts` I see only option: `categories/posts` https://refine.dev/docs/aHow are supabase tables supposed to be created?I did not find any explanation in the documentation who manages the database, or at least informatioHow to transform form data before passing it to data provider?I have an edit page that should only send changed fields to the server instead of the whole form datFirebase with refine-firebase is not working with 3.x.xI tried both packages `refine-firebase` and `ketenburhan/refine-firebase` `ketenburhan/refine-fireInvalidating the service worker cacheAfter using `useUpdate` to modify a resource, the list view resends the `GET` request, but it still making custom errorNotification in mutate function under useDelete hookI'm getting this error on trying to delete an entry. Foreign key violation. update or delete on tabSupabase Auth UI with refine!I would like to use the default AuthUI from supabase with the refine! Is there a stackblitz for thatHow to change the label and icon of the default button that goes back to list in ShowIn the attached example, instead of "POSTS" I want it to be "Back to List" with different icon. ThanChanging the theme of refine MUI with some paid themesHi! We have used refine framework with MUI using the default layout and we are planning to shift to Auth Provider setupHi! I am currently setting up my auth provider and have two question: 1) For some reason, checkAuth How to get params from url in refine?I want to access the params from url in edit page. How can I achieve that? My edit page url is `s/lo