formulaires-validation

Implements Nuxt form patterns with floating labels, local validation, and Laravel 422 error mapping.

Updated May 5, 2025
One-click install
npx skills add https://github.com/sebauvray/toollab-api --skill formulaires-validation-sebauvray
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: formulaires-validation
Source: https://github.com/sebauvray/toollab-api/tree/main/.claude/skills/formulaires-validation
Command: npx skills add https://github.com/sebauvray/toollab-api --skill formulaires-validation-sebauvray

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Building consistent forms in the Toollab Nuxt frontend is error-prone: floating labels drift when error messages appear, deep watchers accidentally erase validation errors, and Laravel 422 responses need correct mapping to fields. This Skill codifies the project's locked-in decisions so new or fixed forms behave consistently. ## Core Features & Use Cases - Floating-label inputs: Use the components/form/* components (InputText, InputSelect, InputNumber) or a CSS-only peer/placeholder-shown pattern anchored at top-[19px] for custom fields like autocomplete. - Local validation in two styles: flat error objects for simple pages, or Laravel-compatible { field: [message] } arrays for modals so server errors overwrite local ones without transformation. - 422 error handling: Map err.response.data.errors onto fields, rephrase confusing server messages client-side, and follow the rule of field-level error OR banner — never both. - Use Case: When adding a payment form with a bank autocomplete, amount input with € suffix, and exoneration justification, apply this Skill to get the stepper, native time input, mousedown-based suggestion selection, and double-submit guard right the first time. ## Quick Start Ask the AI to create or fix a Nuxt form in Toollab following the formulaires-validation conventions, including validation and 422 error display.

Frequently Asked Questions about formulaires-validation

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I build a floating label input in Nuxt with Tailwind?▼

Use the project's InputText or InputSelect components where the placeholder acts as the label, or the CSS-only pattern with placeholder=" " and peer-focus/peer-[:not(:placeholder-shown)] classes. Anchor the label at top-[19px], not top-1/2, so error paragraphs don't shift it.

How to display Laravel 422 validation errors in a Vue form?▼

Read err.response.data.errors and assign it directly to a fieldErrors ref keyed by field name with array values, matching Laravel's format. Fields without a rendered input should also surface in a banner listing all errors so nothing stays invisible.

Why do my form validation errors disappear before the user reads them?▼

A deep watch on the form object clears errors whenever any field mutates, including delayed mutations from a blur setTimeout. Clear errors only on re-validation at submit, on type or mode change, or on form reset.

Should I use click or mousedown for autocomplete suggestion selection?▼

Use mousedown, because it fires before the input's blur event, letting the selection register before the suggestion list closes. This is what makes a delayed blur handler with setTimeout workable.

When should a form show a field error versus an error banner?▼

Show a field-level error for single-field problems and a banner for section or API-level failures, never both for the same cause. Global business errors like exceeding the amount due belong in a banner only.