Skip to content

Commit 707b5ed

Browse files
committed
docs: add canSubmit invalid docs
1 parent 0842cff commit 707b5ed

File tree

4 files changed

+71
-0
lines changed

4 files changed

+71
-0
lines changed

docs/framework/angular/guides/submission-handling.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,3 +102,22 @@ export class AppComponent {
102102
})
103103
}
104104
```
105+
106+
> In a situation where you want to be able to submit in a invalid state `canSubmitWhenInvalid` boolean flag can be provided to useForm.
107+
108+
```angular-ts
109+
import { injectForm } from '@tanstack/angular-form';
110+
111+
export class AppComponent {
112+
form = injectForm({
113+
defaultValues: {
114+
data: '',
115+
},
116+
canSubmitWhenInvalid: true,
117+
onSubmit: async ({ value }) => {
118+
// Do something with the values
119+
console.log(value)
120+
},
121+
});
122+
}
123+
```

docs/framework/react/guides/submission-handling.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,3 +91,18 @@ const form = useForm({
9191
},
9292
})
9393
```
94+
95+
> In a situation where you want to be able to submit in a invalid state `canSubmitWhenInvalid` boolean flag can be provided to useForm.
96+
97+
```tsx
98+
const form = useForm({
99+
defaultValues: {
100+
data: '',
101+
},
102+
canSubmitWhenInvalid: true,
103+
onSubmit: async ({ value }) => {
104+
// Do something with the values
105+
console.log(value)
106+
},
107+
})
108+
```

docs/framework/solid/guides/submission-handling.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,3 +96,20 @@ const form = createForm(() => ({
9696
},
9797
}))
9898
```
99+
100+
> In a situation where you want to be able to submit in a invalid state `canSubmitWhenInvalid` boolean flag can be provided to useForm.
101+
102+
```tsx
103+
import { createForm } from '@tanstack/solid-form'
104+
105+
const form = createForm(() => ({
106+
defaultValues: {
107+
data: '',
108+
},
109+
canSubmitWhenInvalid: true,
110+
onSubmit: async ({ value }) => {
111+
// Do something with the values
112+
console.log(value)
113+
},
114+
}))
115+
```

docs/framework/vue/guides/submission-handling.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,3 +97,23 @@ const form = useForm({
9797
<!-- ... -->
9898
</template>
9999
```
100+
101+
> In a situation where you want to be able to submit in a invalid state `canSubmitWhenInvalid` boolean flag can be provided to useForm.
102+
103+
```vue
104+
<script setup lang="ts">
105+
import { useForm } from '@tanstack/vue-form'
106+
107+
const form = useForm({
108+
defaultValues: { data: '' },
109+
canSubmitWhenInvalid: true,
110+
onSubmit: async ({ value }) => {
111+
// Do something with the values
112+
console.log(value)
113+
},
114+
})
115+
</script>
116+
<template>
117+
<!-- ... -->
118+
</template>
119+
```

0 commit comments

Comments
 (0)