Forms & fields
Typed fields render the form and validate the input.
.phlo
// async form, validated on the server, errors marked in place.
route async POST contact submit {
$email = trim((string)%payload->email)
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) return apply (
class: ['[name=email]' => 'is-error'],
inner: ['#msg' => 'A valid email is required.'],
)
apply(inner: ['#form' => $this->success])
}