docs: remove error mentions in signal forms docs

`error` no longer exists and is called `validate`

(cherry picked from commit 800b01f5a1)
This commit is contained in:
cexbrayat 2025-10-18 15:39:44 +02:00 committed by Andrew Kushnir
parent 2019940ddc
commit eea81c2733

View file

@ -155,7 +155,7 @@ export function form<TModel>(
* ```
* const nameForm = form(signal({first: '', last: ''}), (name) => {
* required(name.first);
* error(name.last, ({value}) => !/^[a-z]+$/i.test(value()), 'Alphabet characters only');
* validate(name.last, ({value}) => !/^[a-z]+$/i.test(value()) ? customError({kind: 'alphabet-only'}) : undefined);
* });
* nameForm().valid(); // false
* nameForm().value.set({first: 'John', last: 'Doe'});
@ -205,22 +205,6 @@ export function form<TModel>(...args: any[]): FieldTree<TModel> {
* });
* ```
*
* When binding logic to the array items, the `FieldTree` for the array item is passed as an
* additional argument. This can be used to reference other properties on the item.
*
* @example
* ```
* const namesForm = form(signal([{first: '', last: ''}]), (names) => {
* applyEach(names, (name) => {
* error(
* name.last,
* (value, nameField) => value === nameField.first().value(),
* 'Last name must be different than first name',
* );
* });
* });
* ```
*
* @param path The target path for an array field whose items the schema will be applied to.
* @param schema A schema for an element of the array, or function that binds logic to an
* element of the array.