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
@@ -818,37 +818,56 @@ Some forms may be repeated as part of a list. In this case you can create separa
818
818
{/each}
819
819
```
820
820
821
-
### buttonProps
821
+
### Multiple submit buttons
822
822
823
-
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.
823
+
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.
824
824
825
-
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.
826
-
827
-
This attribute exists on the `buttonProps` property of a form object:
825
+
To accomplish this, add a field to your schema for the button value, and use `as('submit', value)` to bind it:
0 commit comments