-
Notifications
You must be signed in to change notification settings - Fork 180
Open
Description
Hey!
I've been struggling with the following question:
const submit = ({values}) => {
const isPublic = ?????
await uploadBlog({ title: values.title, isPublic})
}
<Form onSubmit=(submit)>
<TextField field="title" />
<Button type='submit'>Save Draft</Button>
<Button type='submit'>Create Blog</Button>
</Form>
In several cases when it comes to forms, I want to submit a form with slight alterations.
Ergo, as in the example above:
- Saving a draft would upload a blog to the db that's not public
- While clicking "create" would cause it to be public.
I've been racking my brain trying to figure out the cleanest way to perform this... e.g with some type of onClick event on the buttons causing a state change / some hidden input.
But, I feel like there should be a way cleaner and more straightforward way to go about this.
Does anyone have any thoughts?
Cheers!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels