Liking cljdoc? Tell your friends :D
ClojureScript only.

bangmod.form.submission

The runtime behind bangmod.form.core/create-form-submission.

Kept free of reagent on purpose: it only speaks IForm, so the dispatch contract below is unit-tested under :node-test against a reified form, which the reagent-backed ReagentForm cannot be.

The runtime behind `bangmod.form.core/create-form-submission`.

Kept free of reagent on purpose: it only speaks `IForm`, so the dispatch contract below
is unit-tested under `:node-test` against a reified form, which the reagent-backed
`ReagentForm` cannot be.
raw docstring

handlercljs

(handler form f)

(handler form (fn [form values dispatch] ...)) — the :on-submit handler the macro builds. On submit it prevents the event's default, then goes through api/start-submission (touch all, refuse while submitting or with a field in error, mark submitting). If that started, f runs once with the form, its values, and dispatch.

dispatch is how f reports the outcome, exactly once: nil — success string — failure; becomes get-form-display-error promise — resolves to either of the above Anything else, a second call, a rejected promise, a promise resolving to anything else, or f returning without ever calling dispatch (the submission is unhandled) is a programming error: the form is marked failed with the error's message — so it never sticks in submitting — and the error is thrown. For a promise that means the returned promise rejects.

Returns nil, or for a promise outcome the chained promise (so a test can await it).

`(handler form (fn [form values dispatch] ...))` — the `:on-submit` handler the macro
builds. On submit it prevents the event's default, then goes through
`api/start-submission` (touch all, refuse while submitting or with a field in error,
mark submitting). If that started, `f` runs once with the form, its values, and
`dispatch`.

`dispatch` is how `f` reports the outcome, exactly once:
  nil       — success
  string    — failure; becomes `get-form-display-error`
  promise   — resolves to either of the above
Anything else, a second call, a rejected promise, a promise resolving to anything else,
or `f` returning without ever calling `dispatch` (the submission is unhandled) is a
programming error: the form is marked failed with the error's message — so it never
sticks in submitting — and the error is thrown. For a promise that means the returned
promise rejects.

Returns nil, or for a promise outcome the chained promise (so a test can await it).
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close