Skip to content

Instantly share code, notes, and snippets.

@wittyprogramming
wittyprogramming / form-validator.mjs
Last active May 2, 2022 19:32
Form Validation using Alpine.js framework applying a Vue composition-like architecture.
import {
isEmail,
isMaxLength,
isMinLength,
isRequired,
} from "./validators.mjs";
export function formValidator() {
let submitBackend;
return {
@wittyprogramming
wittyprogramming / index.html
Created October 29, 2020 19:33
Netlify Form by using Alpine.js. Implement honeypot, Recaptcha, client-based validation, and AJAX (fetch) submission.
<form
hidden
name="contact"
method="POST"
data-netlify="true"
netlify-honeypot="bot-field"
data-netlify-recaptcha="true"
>
<label><input type="text" name="name" /></label>
<label> <input type="email" name="email" /></label>
@wittyprogramming
wittyprogramming / index.html
Created October 29, 2020 17:37
HTML only code for Netlify using honeypot and recaptcha
<form name="contact" method="POST" data-netlify="true" netlify-honeypot="bot-field" data-netlify-recaptcha="true">
<p hidden>
<label>ignore: <input name="bot-field" /></label>
</p>
<p>
<label>Full Name: <input required type="text" name="name" /></label>
</p>
<p>
<label>Email: <input required type="email" name="email" /></label>
</p>