Skip to content

Commit ab9067b

Browse files
sillvvadummdidumm
andauthored
docs: document how form field name attributes work (#14807)
* fix: document how remote form field `name` attributes work * Update documentation/docs/20-core-concepts/60-remote-functions.md --------- Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
1 parent bd98d7d commit ab9067b

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

documentation/docs/20-core-concepts/60-remote-functions.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,8 @@ A form is composed of a set of _fields_, which are defined by the schema. In the
325325
326326
These attributes allow SvelteKit to set the correct input type, set a `name` that is used to construct the `data` passed to the handler, populate the `value` of the form (for example following a failed submission, to save the user having to re-enter everything), and set the [`aria-invalid`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Reference/Attributes/aria-invalid) state.
327327
328+
> [!NOTE] The generated `name` attribute uses JS object notation (e.g. `nested.array[0].value`). String keys that require quotes such as `object['nested-array'][0].value` are not supported. Under the hood, boolean checkbox and number field names are prefixed with `b:` and `n:`, respectively, to signal SvelteKit to coerce the values from strings prior to validation.
329+
328330
Fields can be nested in objects and arrays, and their values can be strings, numbers, booleans or `File` objects. For example, if your schema looked like this...
329331
330332
```js

0 commit comments

Comments
 (0)