feat(forms): add inline blur validation for name and email

This commit is contained in:
Jennie Robinson Faber 2026-05-23 16:09:36 +01:00
parent 1079e8212f
commit 10f8cab6e3
3 changed files with 66 additions and 0 deletions

View file

@ -32,7 +32,10 @@
class="form-input"
type="text"
required
@blur="validateName"
@input="if (fieldErrors.name) fieldErrors.name = ''"
>
<p v-if="fieldErrors.name" class="field-error">{{ fieldErrors.name }}</p>
</div>
<div class="form-group">
<label class="form-label" for="accept-email">Email</label>
@ -201,6 +204,13 @@ const form = reactive({
agreedToGuidelines: false,
});
// Inline blur validation (UI feedback only does not block submission)
const fieldErrors = reactive({ name: "" });
const validateName = () => {
fieldErrors.name = form.name.trim() ? "" : "Please enter your name.";
};
const isFormValid = computed(() => {
return (
form.name &&
@ -447,6 +457,12 @@ textarea.form-input {
line-height: 1.4;
}
.field-error {
font-size: 11px;
color: var(--ember);
margin-top: 4px;
}
/* ---- CIRCLE RADIOS ---- */
.circle-radios {
display: grid;