cnc-custom-form
A form-shaped wrapper for a submission you handle yourself. It is deliberately
not
a <form>: no action, no submit, no native validation — just your
controls and one place for a form-level error to appear above them.
Quick start
Wrap the controls and bind $error to wherever your submit handler puts its message.
Empty means no alert; anything else renders a danger
cnc-alert
at the top.
<cnc-custom-form $error="err">
<cnc-checkbox name="terms" text="I accept the terms" $checked="agreed"></cnc-checkbox>
<cnc-button label="Save" kind="success" @click="save()"></cnc-button>
</cnc-custom-form>
Submit with the terms unchecked to see the alert, then check them and save again to watch it
clear. Clearing is your job too — the widget only renders whatever
error
currently holds.
What it is not
The wrapper renders a plain div. That means no native submit on Enter, no
required
enforcement, no
FormData
from the element, and no
submit
event — every one of which you get for free from
cnc-form. This widget exists for the cases where you do not want any of it: an RPC
call, a wizard step, a filter panel that applies as you type.
action
and
processing
are the residue of that history. Both are declared on the widget and neither is referenced by
the template, so setting them does nothing at all. They are documented here rather than demoed,
and filed separately.
Usage guidance
Use it when the submission is yours to run and you still want the conventional place for a
form-level error. Use
cnc-form
when you want a real form: posting to an action, native validation, Enter to submit, and a
submit
event to hang your handler on.
Keep error for problems that belong to the form as a whole — "the server
refused this", "these two options conflict". A problem with one field belongs on that field, as
cnc-field's own
error, where the reader is looking when they fix it.