Functions for creating and upating a form, an immutable collection of related
f-form.field
s which will be validated together.
A form usually corresponds to an html <form>
tag. Or to be more precise, one
<form>
is built out of one or more f-form.forms.
Functions for creating and upating a form, an immutable collection of related [[f-form.field]]s which will be validated together. A form usually corresponds to an html `<form>` tag. Or to be more precise, one `<form>` is built out of one or more f-form.forms.
(add-field form field)
Add a new field
to a form
.
Add a new `field` to a `form`.
(changes form)
A nested hashmap containing only the values of the fields with changes. The
keypaths into the returned hashmap are the :field/path
s.
Only works if the fields' trackers have been tracking :field/pristine?
.
Otherwise returns all values.
A nested hashmap containing only the values of the fields with changes. The keypaths into the returned hashmap are the `:field/path`s. Only works if the fields' trackers have been tracking `:field/pristine?`. Otherwise returns all values.
(field-by-path form path)
Returns the field in the form
stored at the given path
.
Returns the field in the `form` stored at the given `path`.
(field-values fields)
Helper: A nested hashmap containing the values of the fields. The keypaths into the
returned hashmap are the :field/path
s.
NOTE: this function expects the fields, as via (fields form)
, not the whole
form.
_Helper:_ A nested hashmap containing the values of the fields. The keypaths into the returned hashmap are the `:field/path`s. NOTE: this function expects the fields, as via `(fields form)`, not the whole form.
(fields form)
(fields form xf)
A seq of the fields on the form
, optionally filtered with xf
.
A seq of the fields on the `form`, optionally filtered with `xf`.
(init)
(init fields)
(init base fields)
Create a form containing the given fields
.
The base
, if provided, is the initial value of the form before it is given
any fields, and can be a place to hold extra data. Avoid conflicts by using
keys from a namespace besides form
.
Create a form containing the given `fields`. The `base`, if provided, is the initial value of the form before it is given any fields, and can be a place to hold extra data. Avoid conflicts by using keys from a namespace besides `form`.
(remove-field-by-path form path)
Remove a field from the form
.
Remove a field from the `form`.
(submitted form)
Mark that the form
is done being submitted.
Mark that the `form` is done being submitted.
(submitting form)
Mark that the form
is being submitted to an external service.
Mark that the `form` is being submitted to an external service.
(submitting? form)
Check whether the form
is currently being submitted.
Check whether the `form` is currently being submitted.
(update-field-by-path form path f & args)
Update a field at the provided path
, as with clojure.core/update
. If
the field does not exist, the update is ignored.
Update a field at the provided `path`, as with `clojure.core/update`. If the field does not exist, the update is ignored.
(value-by-path form path)
Returns the :field/value
of the field stored in the form
at the given
path
.
Returns the `:field/value` of the field stored in the `form` at the given `path`.
(values form)
(values form xf)
A nested hashmap containing the values of all fields, optionally filtered by
xf
. The keypaths into the returned hashmap are the :field/path
s.
A nested hashmap containing the values of all fields, optionally filtered by `xf`. The keypaths into the returned hashmap are the `:field/path`s.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close