You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
breaking: remove `buttonProps` from experimental remote form functions; use e.g. `<button {...myForm.fields.action.as('submit', 'register')}>Register</button>` button instead
Copy file name to clipboardExpand all lines: documentation/docs/20-core-concepts/60-remote-functions.md
+31-12Lines changed: 31 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -815,37 +815,56 @@ Some forms may be repeated as part of a list. In this case you can create separa
815
815
{/each}
816
816
```
817
817
818
-
### buttonProps
818
+
### Multiple submit buttons
819
819
820
-
By default, submitting a form will send a request to the URL indicated by the `<form>` element's [`action`](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/form#attributes_for_form_submission) attribute, which in the case of a remote function is a property on the form object generated by SvelteKit.
820
+
It's possible for a `<form>` to have multiple submit buttons. For example, you might have a single form that allows you to log in or register depending on which button was clicked.
821
821
822
-
It's possible for a `<button>` inside the `<form>` to send the request to a _different_ URL, using the [`formaction`](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/button#formaction) attribute. For example, you might have a single form that allows you to log in or register depending on which button was clicked.
823
-
824
-
This attribute exists on the `buttonProps` property of a form object:
822
+
To accomplish this, add a field to your schema for the button value, and use `as('submit', value)` to bind it:
0 commit comments