- ClayJS
- Reference
- Plugins
- message
message
A visitor's contact form that sends to the document's owner, with a bot check nobody sees.
A visitor’s contact form for the document’s owner.
The form#
A form marked message-form is sent to the document’s owner on the host, with a bot check nobody sees: the page asks the host for a one-time token when the visitor starts filling the form, and the host refuses a message without one. The form resets and the attribute’s text shows as a toast.
<script src="https://clayjs.com/v1/clay.js?plugins=message"></script>
<form message-form="Thanks, I'll reply soon">
<input name="email" type="email" required>
<textarea name="message" required></textarea>
<button>Send</button>
</form>
clay.message.send(data) sends from your own code and resolves { ok, error }, never rejecting. The form fires clay:message-sent or clay:message-failed; cancel it to show your own confirmation instead of the toast. Needs a host with a message endpoint, such as hyperclay.com.
On Hyperclay#
On Hyperclay the message goes from an anonymous viewer to the document’s owner by email, and only if the sender is likely to be human and not a bot. Limits and spam protection: see Form messages.